-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_export.go
42 lines (30 loc) · 1.03 KB
/
build_export.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package sdktypes
import (
"errors"
runtimesv1 "go.autokitteh.dev/autokitteh/proto/gen/go/autokitteh/runtimes/v1"
)
type BuildExport struct {
object[*BuildExportPB, BuildExportTraits]
}
var InvalidBuildExport BuildExport
type BuildExportPB = runtimesv1.Export
type BuildExportTraits struct{}
func (BuildExportTraits) Validate(m *BuildExportPB) error {
return errors.Join(
objectField[CodeLocation]("location", m.Location),
symbolField("symbol", m.Symbol),
)
}
func (BuildExportTraits) StrictValidate(m *BuildExportPB) error {
return nonzeroMessage(m)
}
func BuildExportFromProto(m *BuildExportPB) (BuildExport, error) {
return FromProto[BuildExport](m)
}
func NewBuildExport() BuildExport { return zeroObject[BuildExport]() }
func (r BuildExport) WithLocation(loc CodeLocation) BuildExport {
return BuildExport{r.forceUpdate(func(pb *BuildExportPB) { pb.Location = loc.ToProto() })}
}
func (r BuildExport) WithSymbol(sym Symbol) BuildExport {
return BuildExport{r.forceUpdate(func(pb *BuildExportPB) { pb.Symbol = sym.String() })}
}