Skip to content

Instantly share code, notes, and snippets.

@jfjensen
Created March 4, 2022 15:00
Show Gist options
  • Save jfjensen/f164618b06b94b4ba845c7e45cce2124 to your computer and use it in GitHub Desktop.
Save jfjensen/f164618b06b94b4ba845c7e45cce2124 to your computer and use it in GitHub Desktop.
This is the template for the Director.
package main
type director struct {
builder iBuilder
}
func newDirector(b iBuilder) *director {
return &director{
builder: b,
}
}
func (d *director) setBuilder(b iBuilder) {
d.builder = b
}
func (d *director) build{{title .ProductTarget}}() {{.ProductTarget}} {
{{range .Properties -}}
d.builder.set{{if eq .TypeName `int`}}Num{{end}}{{title .Name}}()
{{end -}}
return d.builder.get{{title .ProductTarget}}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment