-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.gotext
30 lines (28 loc) · 924 Bytes
/
template.gotext
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
{{- /*gotype: github.com/brunolueders/go-builder-gen._builderTemplateData */ -}}
// Code generated by go-builder-gen. DO NOT EDIT.
package {{ .Package }}
type {{ .Target }}Builder struct {
{{- range .Fields }}
{{ unexported .Name }} {{ .Type -}}
{{ end }}
}
func BuilderFrom{{ .Target }}({{ unexported .Target }} {{ .Target }}) {{ .Target }}Builder {
return {{ .Target }}Builder {
{{- range .Fields }}
{{ unexported .Name }}: {{ unexported $.Target }}.{{ .Name }},
{{- end }}
}
}
{{ range .Fields }}
func (builder {{ $.Target }}Builder) With{{ .Name }}({{ unexported .Name }} {{ .Type }}) {{ $.Target }}Builder {
builder.{{ unexported .Name }} = {{ unexported .Name }}
return builder
}
{{ end }}
func (builder {{ .Target }}Builder) Build() *{{ .Target }} {
return &{{ .Target }} {
{{- range .Fields }}
{{ .Name }}: builder.{{ unexported .Name }},
{{- end }}
}
}