Files
2021-11-29 14:55:53 +08:00

27 lines
353 B
Go

package common
type Model struct {
TableName string
}
type Option func(model *Model)
func withModel(tableName string) Option {
return func(model *Model) {
model.TableName = tableName
}
}
func NewModel(option ...Option) *Model {
out := new(Model)
for _, v := range option {
v(out)
}
return out
}
func Test() {
NewModel(withModel(""))
}