github.com/eden-framework/sqlx@v0.0.2/generator/config.go (about)

     1  package generator
     2  
     3  type Config struct {
     4  	StructName string
     5  	TableName  string
     6  	Database   string
     7  
     8  	WithComments        bool
     9  	WithTableName       bool
    10  	WithTableInterfaces bool
    11  	WithMethods         bool
    12  
    13  	FieldPrimaryKey   string
    14  	FieldKeyDeletedAt string
    15  	FieldKeyCreatedAt string
    16  	FieldKeyUpdatedAt string
    17  }
    18  
    19  func (g *Config) SetDefaults() {
    20  	if g.FieldKeyDeletedAt == "" {
    21  		g.FieldKeyDeletedAt = "DeletedAt"
    22  	}
    23  
    24  	if g.FieldKeyCreatedAt == "" {
    25  		g.FieldKeyCreatedAt = "CreatedAt"
    26  	}
    27  
    28  	if g.FieldKeyUpdatedAt == "" {
    29  		g.FieldKeyUpdatedAt = "UpdatedAt"
    30  	}
    31  
    32  	if g.TableName == "" {
    33  		g.TableName = toDefaultTableName(g.StructName)
    34  	}
    35  }