Created
March 4, 2022 15:00
-
-
Save jfjensen/f164618b06b94b4ba845c7e45cce2124 to your computer and use it in GitHub Desktop.
This is the template for the Director.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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