entc/gen: initial work for multi-schema migration using atlasgo.io (#3821)

This commit is contained in:
Ariel Mashraki
2023-11-13 12:35:31 +02:00
committed by GitHub
parent 50938a51c6
commit 9aba4ae091
116 changed files with 15265 additions and 203 deletions

View File

@@ -39,9 +39,7 @@ type Client struct {
// NewClient creates a new client configured with the given options.
func NewClient(opts ...Option) *Client {
cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
cfg.options(opts...)
client := &Client{config: cfg}
client := &Client{config: newConfig(opts...)}
client.init()
return client
}
@@ -71,6 +69,13 @@ type (
Option func(*config)
)
// newConfig creates a new config for the client.
func newConfig(opts ...Option) config {
cfg := config{log: log.Println, hooks: &hooks{}, inters: &inters{}}
cfg.options(opts...)
return cfg
}
// options applies the options on the config object.
func (c *config) options(opts ...Option) {
for _, opt := range opts {