entc/gen: move schemaconfig template to feature-flag

This commit is contained in:
Ariel Mashraki
2021-01-20 12:29:46 +02:00
committed by Ariel Mashraki
parent 0e7823383e
commit aeb1ccc571
75 changed files with 10705 additions and 151 deletions

View File

@@ -68,7 +68,8 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
if err != nil {
return nil, fmt.Errorf("ent: starting a transaction: %v", err)
}
cfg := config{driver: tx, log: c.log, debug: c.debug, hooks: c.hooks}
cfg := c.config
cfg.driver = tx
return &Tx{
ctx: ctx,
config: cfg,
@@ -87,7 +88,8 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
if err != nil {
return nil, fmt.Errorf("ent: starting a transaction: %v", err)
}
cfg := config{driver: &txDriver{tx: tx, drv: c.driver}, log: c.log, debug: c.debug, hooks: c.hooks}
cfg := c.config
cfg.driver = &txDriver{tx: tx, drv: c.driver}
return &Tx{
config: cfg,
User: NewUserClient(cfg),
@@ -105,7 +107,8 @@ func (c *Client) Debug() *Client {
if c.debug {
return c
}
cfg := config{driver: dialect.Debug(c.driver, c.log), log: c.log, debug: true, hooks: c.hooks}
cfg := c.config
cfg.driver = dialect.Debug(c.driver, c.log)
client := &Client{config: cfg}
client.init()
return client