entc/gen: change verbose option to debug

Summary: Change the Verbose option to Debug

Reviewed By: alexsn

Differential Revision: D17091911

fbshipit-source-id: c5cf3e1c7f33f607076fe5c7da94e04b9f236218
This commit is contained in:
Ariel Mashraki
2019-08-28 06:44:37 -07:00
committed by Facebook Github Bot
parent a964901521
commit e7fec6f8f9
29 changed files with 178 additions and 200 deletions

View File

@@ -47,7 +47,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
City: NewCityClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -47,7 +47,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
Group: NewGroupClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -43,7 +43,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
User: NewUserClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -43,7 +43,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
User: NewUserClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -47,7 +47,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
Pet: NewPetClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -43,7 +43,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
Node: NewNodeClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -47,7 +47,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
Card: NewCardClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -43,7 +43,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
User: NewUserClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn

View File

@@ -43,7 +43,7 @@ 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, verbose: c.verbose}
cfg := config{driver: tx, log: c.log, debug: c.debug}
return &Tx{
config: cfg,
Node: NewNodeClient(cfg),

View File

@@ -11,11 +11,11 @@ type Option func(*config)
// Config is the configuration for the client and its builder.
type config struct {
// driver is the driver used for execute database requests.
// driver used for executing database requests.
driver dialect.Driver
// verbose enable a verbosity logging.
verbose bool
// log used for logging on verbose mode.
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
}
@@ -24,19 +24,19 @@ func (c *config) options(opts ...Option) {
for _, opt := range opts {
opt(c)
}
if c.verbose {
if c.debug {
c.driver = dialect.Debug(c.driver, c.log)
}
}
// Verbose sets the client logging to verbose.
func Verbose() Option {
// Debug enables debug logging on the ent.Driver.
func Debug() Option {
return func(c *config) {
c.verbose = true
c.debug = true
}
}
// Log sets the client logging to verbose.
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
return func(c *config) {
c.log = fn