Versions in this module Expand all Collapse all v1 v1.0.5 Feb 11, 2022 v1.0.4 Feb 11, 2022 Changes in this version + var Debug doOptions = func(db *gorm.DB) *gorm.DB + var ErrEmptyCondition = errors.New("empty condition") + var FieldAddPrefix = func(prefix string) model.ModifyFieldOpt + var FieldAddSuffix = func(suffix string) model.ModifyFieldOpt + var FieldGORMTag = func(columnName string, gormTag string) model.ModifyFieldOpt + var FieldIgnore = func(columnNames ...string) model.FilterFieldOpt + var FieldIgnoreReg = func(columnNameRegs ...string) model.FilterFieldOpt + var FieldJSONTag = func(columnName string, jsonTag string) model.ModifyFieldOpt + var FieldJSONTagWithNS = func(schemaName func(columnName string) (tagContent string)) model.ModifyFieldOpt + var FieldNew = func(fieldName, fieldType, fieldTag string) model.CreateFieldOpt + var FieldNewTag = func(columnName string, newTag string) model.ModifyFieldOpt + var FieldNewTagWithNS = func(tagName string, schemaName func(columnName string) string) model.ModifyFieldOpt + var FieldRelate = func(relationship field.RelationshipType, fieldName string, table *check.BaseStruct, ...) model.CreateFieldOpt + var FieldRelateModel = func(relationship field.RelationshipType, fieldName string, relModel interface{}, ...) model.CreateFieldOpt + var FieldRename = func(columnName string, newName string) model.ModifyFieldOpt + var FieldTag = func(columnName string, gormTag, jsonTag string) model.ModifyFieldOpt + var FieldTrimPrefix = func(prefix string) model.ModifyFieldOpt + var FieldTrimSuffix = func(suffix string) model.ModifyFieldOpt + var FieldType = func(columnName string, newType string) model.ModifyFieldOpt + var FieldTypeReg = func(columnNameReg string, newType string) model.ModifyFieldOpt + func CheckClause(cond clause.Expression) error + type Condition interface + BeCond func() interface{} + CondError func() error + func Cond(exprs ...clause.Expression) []Condition + type Config struct + FieldCoverable bool + FieldNullable bool + FieldWithIndexTag bool + FieldWithTypeTag bool + Mode GenerateMode + ModelPkgPath string + OutFile string + OutPath string + WithUnitTest bool + func (cfg *Config) Revise() (err error) + func (cfg *Config) WithDataTypeMap(newMap map[string]func(detailType string) (dataType string)) + func (cfg *Config) WithDbNameOpts(opts ...model.SchemaNameOpt) + func (cfg *Config) WithFileNameStrategy(ns func(tableName string) (fieldName string)) + func (cfg *Config) WithImportPkgPath(path ...string) + func (cfg *Config) WithJSONTagNameStrategy(ns func(columnName string) (tagContent string)) + func (cfg *Config) WithModelNameStrategy(ns func(tableName string) (modelName string)) + func (cfg *Config) WithNewTagNameStrategy(ns func(columnName string) (tagContent string)) + func (cfg *Config) WithTableNameStrategy(ns func(tableName string) (targetTableName string)) + type DO struct + func (*DO) Columns(cols ...field.Expr) columns + func (d *DO) Assign(attrs ...field.AssignExpr) Dao + func (d *DO) Attrs(attrs ...field.AssignExpr) Dao + func (d *DO) BeCond() interface{} + func (d *DO) Build(builder clause.Builder) + func (d *DO) Clauses(conds ...clause.Expression) Dao + func (d *DO) CondError() error + func (d *DO) Count() (count int64, err error) + func (d *DO) Create(value interface{}) error + func (d *DO) CreateInBatches(value interface{}, batchSize int) error + func (d *DO) Debug() Dao + func (d *DO) Delete() (info ResultInfo, err error) + func (d *DO) Distinct(columns ...field.Expr) Dao + func (d *DO) Find() (results interface{}, err error) + func (d *DO) FindInBatches(dest interface{}, batchSize int, fc func(tx Dao, batch int) error) error + func (d *DO) First() (result interface{}, err error) + func (d *DO) FirstOrCreate() (result interface{}, err error) + func (d *DO) FirstOrInit() (result interface{}, err error) + func (d *DO) Group(columns ...field.Expr) Dao + func (d *DO) Having(conds ...Condition) Dao + func (d *DO) Join(table schema.Tabler, conds ...field.Expr) Dao + func (d *DO) Joins(field field.RelationField) Dao + func (d *DO) Last() (result interface{}, err error) + func (d *DO) LeftJoin(table schema.Tabler, conds ...field.Expr) Dao + func (d *DO) Limit(limit int) Dao + func (d *DO) Not(conds ...Condition) Dao + func (d *DO) Offset(offset int) Dao + func (d *DO) Omit(columns ...field.Expr) Dao + func (d *DO) Or(conds ...Condition) Dao + func (d *DO) Order(columns ...field.Expr) Dao + func (d *DO) Pluck(column field.Expr, dest interface{}) error + func (d *DO) Preload(field field.RelationField) Dao + func (d *DO) Quote(raw string) string + func (d *DO) ReplaceDB(db *gorm.DB) + func (d *DO) RightJoin(table schema.Tabler, conds ...field.Expr) Dao + func (d *DO) Row() *sql.Row + func (d *DO) Rows() (*sql.Rows, error) + func (d *DO) Save(value interface{}) error + func (d *DO) Scan(dest interface{}) error + func (d *DO) ScanRows(rows *sql.Rows, dest interface{}) error + func (d *DO) Scopes(funcs ...func(Dao) Dao) Dao + func (d *DO) Select(columns ...field.Expr) Dao + func (d *DO) Session(config *gorm.Session) Dao + func (d *DO) Take() (result interface{}, err error) + func (d *DO) UnderlyingDB() *gorm.DB + func (d *DO) Unscoped() Dao + func (d *DO) Update(column field.Expr, value interface{}) (info ResultInfo, err error) + func (d *DO) UpdateColumn(column field.Expr, value interface{}) (info ResultInfo, err error) + func (d *DO) UpdateColumnSimple(columns ...field.AssignExpr) (info ResultInfo, err error) + func (d *DO) UpdateColumns(value interface{}) (info ResultInfo, err error) + func (d *DO) UpdateFrom(q subQuery) Dao + func (d *DO) UpdateSimple(columns ...field.AssignExpr) (info ResultInfo, err error) + func (d *DO) Updates(value interface{}) (info ResultInfo, err error) + func (d *DO) UseDB(db *gorm.DB, opts ...doOptions) + func (d *DO) UseModel(model interface{}) + func (d *DO) UseTable(tableName string) + func (d *DO) Where(conds ...Condition) Dao + func (d *DO) WithContext(ctx context.Context) Dao + func (d DO) As(alias string) Dao + func (d DO) TableName() string + func (d DO) WithResult(fc func(tx Dao)) ResultInfo + type Dao interface + As func(alias string) Dao + Assign func(attrs ...field.AssignExpr) Dao + Attrs func(attrs ...field.AssignExpr) Dao + Count func() (int64, error) + Create func(value interface{}) error + CreateInBatches func(value interface{}, batchSize int) error + Delete func() (info ResultInfo, err error) + Distinct func(columns ...field.Expr) Dao + Find func() (results interface{}, err error) + FindInBatches func(dest interface{}, batchSize int, fc func(tx Dao, batch int) error) error + First func() (result interface{}, err error) + FirstOrCreate func() (result interface{}, err error) + FirstOrInit func() (result interface{}, err error) + Group func(columns ...field.Expr) Dao + Having func(conds ...Condition) Dao + Join func(table schema.Tabler, conds ...field.Expr) Dao + Joins func(field field.RelationField) Dao + Last func() (result interface{}, err error) + LeftJoin func(table schema.Tabler, conds ...field.Expr) Dao + Limit func(limit int) Dao + Not func(conds ...Condition) Dao + Offset func(offset int) Dao + Omit func(columns ...field.Expr) Dao + Or func(conds ...Condition) Dao + Order func(columns ...field.Expr) Dao + Pluck func(column field.Expr, dest interface{}) error + Preload func(field field.RelationField) Dao + RightJoin func(table schema.Tabler, conds ...field.Expr) Dao + Row func() *sql.Row + Rows func() (*sql.Rows, error) + Save func(value interface{}) error + Scan func(dest interface{}) error + ScanRows func(rows *sql.Rows, dest interface{}) error + Scopes func(funcs ...func(Dao) Dao) Dao + Select func(columns ...field.Expr) Dao + Take func() (result interface{}, err error) + Unscoped func() Dao + Update func(column field.Expr, value interface{}) (info ResultInfo, err error) + UpdateColumn func(column field.Expr, value interface{}) (info ResultInfo, err error) + UpdateColumnSimple func(columns ...field.AssignExpr) (info ResultInfo, err error) + UpdateColumns func(values interface{}) (info ResultInfo, err error) + UpdateSimple func(columns ...field.AssignExpr) (info ResultInfo, err error) + Updates func(values interface{}) (info ResultInfo, err error) + Where func(conds ...Condition) Dao + func Table(subQueries ...subQuery) Dao + type FieldOpt model.FieldOpt + type GenerateMode uint + const WithDefaultQuery + const WithoutContext + type Generator struct + Data map[string]*genInfo + func NewGenerator(cfg Config) *Generator + func (g *Generator) ApplyBasic(models ...interface{}) + func (g *Generator) ApplyInterface(fc interface{}, models ...interface{}) + func (g *Generator) Execute() + func (g *Generator) GenerateAllTable(opts ...FieldOpt) (tableModels []interface{}) + func (g *Generator) GenerateModel(tableName string, opts ...FieldOpt) *check.BaseStruct + func (g *Generator) GenerateModelAs(tableName string, modelName string, fieldOpts ...FieldOpt) *check.BaseStruct + func (g *Generator) UseDB(db *gorm.DB) + type M map[string]interface + type ResultInfo struct + Error error + RowsAffected int64 + type RowsAffected int64 + type T interface