Documentation ¶
Index ¶
- Variables
- func Expr(expr string, args ...interface{}) clause.Expr
- func Scan(rows Rows, db *DB, mode ScanMode)
- type Association
- func (association *Association) Append(values ...interface{}) error
- func (association *Association) Clear() error
- func (association *Association) Count() (count int64)
- func (association *Association) Delete(values ...interface{}) error
- func (association *Association) Find(out interface{}, conds ...interface{}) error
- func (association *Association) Replace(values ...interface{}) error
- type ColumnType
- type Config
- type ConnPool
- type ConnPoolBeginner
- type DB
- func (db *DB) AddError(err error) error
- func (db *DB) Assign(attrs ...interface{}) (tx *DB)
- func (db *DB) Association(column string) *Association
- func (db *DB) Attrs(attrs ...interface{}) (tx *DB)
- func (db *DB) AutoMigrate(dst ...interface{}) error
- func (db *DB) Begin(opts ...*sql.TxOptions) *DB
- func (db *DB) Callback() *callbacks
- func (db *DB) Clauses(conds ...clause.Expression) (tx *DB)
- func (db *DB) Commit() *DB
- func (db *DB) Connection(fc func(tx *DB) error) (err error)
- func (db *DB) Count(count *int64) (tx *DB)
- func (db *DB) Create(value interface{}) (tx *DB)
- func (db *DB) CreateInBatches(value interface{}, batchSize int) (tx *DB)
- func (db *DB) DB() (*sql.DB, error)
- func (db *DB) Debug() (tx *DB)
- func (db *DB) Delete(value interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) Distinct(args ...interface{}) (tx *DB)
- func (db *DB) Exec(sql string, values ...interface{}) (tx *DB)
- func (db *DB) Find(dest interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *DB, batch int) error) *DB
- func (db *DB) First(dest interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) FirstOrCreate(dest interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) FirstOrInit(dest interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) Get(key string) (interface{}, bool)
- func (db *DB) Group(name string) (tx *DB)
- func (db *DB) Having(query interface{}, args ...interface{}) (tx *DB)
- func (db *DB) InstanceGet(key string) (interface{}, bool)
- func (db *DB) InstanceSet(key string, value interface{}) *DB
- func (db *DB) Joins(query string, args ...interface{}) (tx *DB)
- func (db *DB) Last(dest interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) Limit(limit int) (tx *DB)
- func (db *DB) Migrator() Migrator
- func (db *DB) Model(value interface{}) (tx *DB)
- func (db *DB) Not(query interface{}, args ...interface{}) (tx *DB)
- func (db *DB) Offset(offset int) (tx *DB)
- func (db *DB) Omit(columns ...string) (tx *DB)
- func (db *DB) Or(query interface{}, args ...interface{}) (tx *DB)
- func (db *DB) Order(value interface{}) (tx *DB)
- func (db *DB) Pluck(column string, dest interface{}) (tx *DB)
- func (db *DB) Preload(query string, args ...interface{}) (tx *DB)
- func (db *DB) Raw(sql string, values ...interface{}) (tx *DB)
- func (db *DB) Rollback() *DB
- func (db *DB) RollbackTo(name string) *DB
- func (db *DB) Row() *sql.Row
- func (db *DB) Rows() (*sql.Rows, error)
- func (db *DB) Save(value interface{}) (tx *DB)
- func (db *DB) SavePoint(name string) *DB
- func (db *DB) Scan(dest interface{}) (tx *DB)
- func (db *DB) ScanRows(rows *sql.Rows, dest interface{}) error
- func (db *DB) Scopes(funcs ...func(*DB) *DB) (tx *DB)
- func (db *DB) Select(query interface{}, args ...interface{}) (tx *DB)
- func (db *DB) Session(config *Session) *DB
- func (db *DB) Set(key string, value interface{}) *DB
- func (db *DB) SetupJoinTable(model interface{}, field string, joinTable interface{}) error
- func (db *DB) Table(name string, args ...interface{}) (tx *DB)
- func (db *DB) Take(dest interface{}, conds ...interface{}) (tx *DB)
- func (db *DB) ToSQL(queryFn func(tx *DB) *DB) string
- func (db *DB) Transaction(fc func(tx *DB) error, opts ...*sql.TxOptions) (err error)
- func (db *DB) Unscoped() (tx *DB)
- func (db *DB) Update(column string, value interface{}) (tx *DB)
- func (db *DB) UpdateColumn(column string, value interface{}) (tx *DB)
- func (db *DB) UpdateColumns(values interface{}) (tx *DB)
- func (db *DB) Updates(values interface{}) (tx *DB)
- func (db *DB) Use(plugin Plugin) error
- func (db *DB) Where(query interface{}, args ...interface{}) (tx *DB)
- func (db *DB) WithContext(ctx context.Context) *DB
- type DeletedAt
- func (DeletedAt) DeleteClauses(f *schema.Field) []clause.Interface
- func (n DeletedAt) MarshalJSON() ([]byte, error)
- func (DeletedAt) QueryClauses(f *schema.Field) []clause.Interface
- func (n *DeletedAt) Scan(value interface{}) error
- func (n *DeletedAt) UnmarshalJSON(b []byte) error
- func (DeletedAt) UpdateClauses(f *schema.Field) []clause.Interface
- func (n DeletedAt) Value() (driver.Value, error)
- type Dialector
- type GetDBConnector
- type Migrator
- type Model
- type Option
- type Plugin
- type PreparedStmtDB
- func (db *PreparedStmtDB) BeginTx(ctx context.Context, opt *sql.TxOptions) (ConnPool, error)
- func (db *PreparedStmtDB) Close()
- func (db *PreparedStmtDB) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error)
- func (db *PreparedStmtDB) GetDBConn() (*sql.DB, error)
- func (db *PreparedStmtDB) QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
- func (db *PreparedStmtDB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- type PreparedStmtTX
- func (tx *PreparedStmtTX) Commit() error
- func (tx *PreparedStmtTX) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error)
- func (tx *PreparedStmtTX) QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
- func (tx *PreparedStmtTX) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (tx *PreparedStmtTX) Rollback() error
- type Rows
- type SavePointerDialectorInterface
- type ScanMode
- type Session
- type SoftDeleteDeleteClause
- type SoftDeleteQueryClause
- type SoftDeleteUpdateClause
- type Statement
- func (stmt *Statement) AddClause(v clause.Interface)
- func (stmt *Statement) AddClauseIfNotExists(v clause.Interface)
- func (stmt *Statement) AddVar(writer clause.Writer, vars ...interface{})
- func (stmt *Statement) Build(clauses ...string)
- func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []clause.Expression
- func (stmt *Statement) Changed(fields ...string) bool
- func (stmt *Statement) Parse(value interface{}) (err error)
- func (stmt *Statement) ParseWithSpecialTableName(value interface{}, specialTableName string) (err error)
- func (stmt *Statement) Quote(field interface{}) string
- func (stmt *Statement) QuoteTo(writer clause.Writer, field interface{})
- func (stmt *Statement) SelectAndOmitColumns(requireCreate, requireUpdate bool) (map[string]bool, bool)
- func (stmt *Statement) SetColumn(name string, value interface{}, fromCallbacks ...bool)
- func (stmt *Statement) WriteByte(c byte) error
- func (stmt *Statement) WriteQuoted(value interface{})
- func (stmt *Statement) WriteString(str string) (int, error)
- type StatementModifier
- type Stmt
- type Tx
- type TxBeginner
- type TxCommitter
- type Valuer
- type ViewOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRecordNotFound record not found error ErrRecordNotFound = logger.ErrRecordNotFound // ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = errors.New("invalid transaction") // ErrNotImplemented not implemented ErrNotImplemented = errors.New("not implemented") // ErrMissingWhereClause missing where clause ErrMissingWhereClause = errors.New("WHERE conditions required") // ErrUnsupportedRelation unsupported relations ErrUnsupportedRelation = errors.New("unsupported relations") // ErrPrimaryKeyRequired primary keys required ErrPrimaryKeyRequired = errors.New("primary key required") // ErrModelValueRequired model value required ErrModelValueRequired = errors.New("model value required") // ErrInvalidData unsupported data ErrInvalidData = errors.New("unsupported data") // ErrUnsupportedDriver unsupported driver ErrUnsupportedDriver = errors.New("unsupported driver") // ErrRegistered registered ErrRegistered = errors.New("registered") // ErrInvalidField invalid field ErrInvalidField = errors.New("invalid field") // ErrEmptySlice empty slice found ErrEmptySlice = errors.New("empty slice found") // ErrDryRunModeUnsupported dry run mode unsupported ErrDryRunModeUnsupported = errors.New("dry run mode unsupported") // ErrInvalidDB invalid db ErrInvalidDB = errors.New("invalid db") // ErrInvalidValue invalid value ErrInvalidValue = errors.New("invalid value, should be pointer to struct or slice") // ErrInvalidValueOfLength invalid values do not match length ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match") // ErrPreloadNotAllowed preload is not allowed when count is used ErrPreloadNotAllowed = errors.New("preload is not allowed when count is used") )
Functions ¶
Types ¶
type Association ¶
type Association struct { DB *DB Relationship *schema.Relationship Error error }
Association Mode contains some helper methods to handle relationship things easily.
func (*Association) Append ¶
func (association *Association) Append(values ...interface{}) error
func (*Association) Clear ¶
func (association *Association) Clear() error
func (*Association) Count ¶
func (association *Association) Count() (count int64)
func (*Association) Delete ¶
func (association *Association) Delete(values ...interface{}) error
func (*Association) Find ¶
func (association *Association) Find(out interface{}, conds ...interface{}) error
func (*Association) Replace ¶
func (association *Association) Replace(values ...interface{}) error
type ColumnType ¶ added in v1.24.1
type ColumnType interface { Name() string DatabaseTypeName() string // varchar ColumnType() (columnType string, ok bool) // varchar(64) PrimaryKey() (isPrimaryKey bool, ok bool) AutoIncrement() (isAutoIncrement bool, ok bool) Length() (length int64, ok bool) DecimalSize() (precision int64, scale int64, ok bool) Nullable() (nullable bool, ok bool) Unique() (unique bool, ok bool) ScanType() reflect.Type Comment() (value string, ok bool) DefaultValue() (value string, ok bool) }
ColumnType column type interface
type Config ¶ added in v1.24.1
type Config struct { // GORM perform single create, update, delete operations in transactions by default to ensure database data integrity // You can disable it by setting `SkipDefaultTransaction` to true SkipDefaultTransaction bool // NamingStrategy tables, columns naming strategy NamingStrategy schema.Namer // FullSaveAssociations full save associations FullSaveAssociations bool // Logger Logger logger.Interface // NowFunc the function to be used when creating a new timestamp NowFunc func() time.Time // DryRun generate sql without execute DryRun bool // PrepareStmt executes the given query in cached statement PrepareStmt bool // DisableAutomaticPing DisableAutomaticPing bool // DisableForeignKeyConstraintWhenMigrating DisableForeignKeyConstraintWhenMigrating bool // DisableNestedTransaction disable nested transaction DisableNestedTransaction bool // AllowGlobalUpdate allow global update AllowGlobalUpdate bool // QueryFields executes the SQL query with all fields of the table QueryFields bool // CreateBatchSize default create batch size CreateBatchSize int // ClauseBuilders clause builder ClauseBuilders map[string]clause.ClauseBuilder // ConnPool db conn pool ConnPool ConnPool // Dialector database dialector Dialector // Plugins registered plugins Plugins map[string]Plugin // contains filtered or unexported fields }
Config GORM config
func (*Config) AfterInitialize ¶ added in v1.24.1
AfterInitialize initialize plugins after db connected
type ConnPool ¶ added in v1.24.1
type ConnPool interface { PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row }
ConnPool db conns pool interface
type ConnPoolBeginner ¶ added in v1.24.1
type ConnPoolBeginner interface {
BeginTx(ctx context.Context, opts *sql.TxOptions) (ConnPool, error)
}
ConnPoolBeginner conn pool beginner
type DB ¶
type DB struct { *Config Error error RowsAffected int64 Statement *Statement // contains filtered or unexported fields }
DB GORM DB definition
func (*DB) Association ¶
func (db *DB) Association(column string) *Association
func (*DB) AutoMigrate ¶
AutoMigrate run auto migration for given models
func (*DB) Clauses ¶ added in v1.24.1
func (db *DB) Clauses(conds ...clause.Expression) (tx *DB)
Clauses Add clauses
func (*DB) Connection ¶ added in v1.24.1
Connection use a db conn to execute Multiple commands,this conn will put conn pool after it is executed.
func (*DB) CreateInBatches ¶ added in v1.24.1
CreateInBatches insert the value in batches into database
func (*DB) Delete ¶
Delete delete value match given conditions, if the value has primary key, then will including the primary key as condition
func (*DB) FindInBatches ¶ added in v1.24.1
FindInBatches find records in batches
func (*DB) FirstOrCreate ¶
FirstOrCreate gets the first matched record or create a new one with given conditions (only works with struct, map conditions)
func (*DB) FirstOrInit ¶
FirstOrInit gets the first matched record or initialize a new instance with given conditions (only works with struct or map conditions)
func (*DB) InstanceGet ¶ added in v1.24.1
InstanceGet get value with key from current db instance's context
func (*DB) InstanceSet ¶ added in v1.24.1
InstanceSet store value with key into current db instance's context
func (*DB) Joins ¶
Joins specify Joins conditions
db.Joins("Account").Find(&user) db.Joins("JOIN emails ON emails.user_id = users.id AND emails.email = ?", "jinzhu@example.org").Find(&user) db.Joins("Account", DB.Select("id").Where("user_id = users.id AND name = ?", "someName").Model(&Account{}))
func (*DB) Model ¶
Model specify the model you would like to run db operations
// update all users's name to `hello` db.Model(&User{}).Update("name", "hello") // if user's primary key is non-blank, will use it as condition, then will only update the user's name to `hello` db.Model(&user).Update("name", "hello")
func (*DB) Offset ¶
Offset specify the number of records to skip before starting to return the records
func (*DB) Order ¶
Order specify order when retrieve records from database
db.Order("name DESC") db.Order(clause.OrderByColumn{Column: clause.Column{Name: "name"}, Desc: true})
func (*DB) Pluck ¶
Pluck used to query single column from a model as a map
var ages []int64 db.Model(&users).Pluck("age", &ages)
func (*DB) Preload ¶
Preload preload associations with given conditions
db.Preload("Orders", "state NOT IN (?)", "cancelled").Find(&users)
func (*DB) RollbackTo ¶ added in v1.24.1
func (*DB) Save ¶
Save update value in database, if the value doesn't have primary key, will insert it
func (*DB) Scopes ¶
Scopes pass current database connection to arguments `func(DB) DB`, which could be used to add conditions dynamically
func AmountGreaterThan1000(db *gorm.DB) *gorm.DB { return db.Where("amount > ?", 1000) } func OrderStatus(status []string) func (db *gorm.DB) *gorm.DB { return func (db *gorm.DB) *gorm.DB { return db.Scopes(AmountGreaterThan1000).Where("status in (?)", status) } } db.Scopes(AmountGreaterThan1000, OrderStatus([]string{"paid", "shipped"})).Find(&orders)
func (*DB) SetupJoinTable ¶ added in v1.24.1
SetupJoinTable setup join table schema
func (*DB) Take ¶
Take return a record that match given conditions, the order will depend on the database implementation
func (*DB) ToSQL ¶ added in v1.24.1
ToSQL for generate SQL string.
db.ToSQL(func(tx *gorm.DB) *gorm.DB { return tx.Model(&User{}).Where(&User{Name: "foo", Age: 20}) .Limit(10).Offset(5) .Order("name ASC") .First(&User{}) })
func (*DB) Transaction ¶ added in v1.10.0
Transaction start a transaction as a block, return error will rollback, otherwise to commit.
func (*DB) Update ¶
Update update attributes with callbacks, refer: https://gorm.io/docs/update.html#Update-Changed-Fields
func (*DB) UpdateColumn ¶
func (*DB) UpdateColumns ¶
func (*DB) Updates ¶
Updates update attributes with callbacks, refer: https://gorm.io/docs/update.html#Update-Changed-Fields
type DeletedAt ¶ added in v1.24.1
func (DeletedAt) DeleteClauses ¶ added in v1.24.1
func (DeletedAt) MarshalJSON ¶ added in v1.24.1
func (DeletedAt) QueryClauses ¶ added in v1.24.1
func (*DeletedAt) UnmarshalJSON ¶ added in v1.24.1
func (DeletedAt) UpdateClauses ¶ added in v1.24.1
type Dialector ¶ added in v1.24.1
type Dialector interface { Name() string Initialize(*DB) error Migrator(db *DB) Migrator DataTypeOf(*schema.Field) string DefaultValueOf(*schema.Field) clause.Expression BindVarTo(writer clause.Writer, stmt *Statement, v interface{}) QuoteTo(clause.Writer, string) Explain(sql string, vars ...interface{}) string }
Dialector GORM database dialector
type GetDBConnector ¶ added in v1.24.1
GetDBConnector SQL db connector
type Migrator ¶ added in v1.24.1
type Migrator interface { // AutoMigrate AutoMigrate(dst ...interface{}) error // Database CurrentDatabase() string FullDataTypeOf(*schema.Field) clause.Expr // Tables CreateTable(dst ...interface{}) error DropTable(dst ...interface{}) error HasTable(dst interface{}) bool RenameTable(oldName, newName interface{}) error GetTables() (tableList []string, err error) // Columns AddColumn(dst interface{}, field string) error DropColumn(dst interface{}, field string) error AlterColumn(dst interface{}, field string) error MigrateColumn(dst interface{}, field *schema.Field, columnType ColumnType) error HasColumn(dst interface{}, field string) bool RenameColumn(dst interface{}, oldName, field string) error ColumnTypes(dst interface{}) ([]ColumnType, error) // Views CreateView(name string, option ViewOption) error DropView(name string) error // Constraints CreateConstraint(dst interface{}, name string) error DropConstraint(dst interface{}, name string) error HasConstraint(dst interface{}, name string) bool // Indexes CreateIndex(dst interface{}, name string) error DropIndex(dst interface{}, name string) error HasIndex(dst interface{}, name string) bool RenameIndex(dst interface{}, oldName, newName string) error }
Migrator migrator interface
type Model ¶
type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time DeletedAt DeletedAt `gorm:"index"` }
Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt It may be embedded into your model or you may build your own model without it
type User struct { gorm.Model }
type PreparedStmtDB ¶ added in v1.24.1
type PreparedStmtDB struct { Stmts map[string]Stmt PreparedSQL []string Mux *sync.RWMutex ConnPool }
func (*PreparedStmtDB) Close ¶ added in v1.24.1
func (db *PreparedStmtDB) Close()
func (*PreparedStmtDB) ExecContext ¶ added in v1.24.1
func (*PreparedStmtDB) GetDBConn ¶ added in v1.24.1
func (db *PreparedStmtDB) GetDBConn() (*sql.DB, error)
func (*PreparedStmtDB) QueryContext ¶ added in v1.24.1
func (*PreparedStmtDB) QueryRowContext ¶ added in v1.24.1
type PreparedStmtTX ¶ added in v1.24.1
type PreparedStmtTX struct { Tx PreparedStmtDB *PreparedStmtDB }
func (*PreparedStmtTX) Commit ¶ added in v1.24.1
func (tx *PreparedStmtTX) Commit() error
func (*PreparedStmtTX) ExecContext ¶ added in v1.24.1
func (*PreparedStmtTX) QueryContext ¶ added in v1.24.1
func (*PreparedStmtTX) QueryRowContext ¶ added in v1.24.1
func (*PreparedStmtTX) Rollback ¶ added in v1.24.1
func (tx *PreparedStmtTX) Rollback() error
type Rows ¶ added in v1.24.1
type Rows interface { Columns() ([]string, error) ColumnTypes() ([]*sql.ColumnType, error) Next() bool Scan(dest ...interface{}) error Err() error Close() error }
Rows rows interface
type SavePointerDialectorInterface ¶ added in v1.24.1
type SavePointerDialectorInterface interface { SavePoint(tx *DB, name string) error RollbackTo(tx *DB, name string) error }
SavePointerDialectorInterface save pointer interface
type Session ¶ added in v1.24.1
type Session struct { DryRun bool PrepareStmt bool NewDB bool Initialized bool SkipHooks bool SkipDefaultTransaction bool DisableNestedTransaction bool AllowGlobalUpdate bool FullSaveAssociations bool QueryFields bool Context context.Context Logger logger.Interface NowFunc func() time.Time CreateBatchSize int }
Session session config when create session with Session() method
type SoftDeleteDeleteClause ¶ added in v1.24.1
func (SoftDeleteDeleteClause) Build ¶ added in v1.24.1
func (sd SoftDeleteDeleteClause) Build(clause.Builder)
func (SoftDeleteDeleteClause) MergeClause ¶ added in v1.24.1
func (sd SoftDeleteDeleteClause) MergeClause(*clause.Clause)
func (SoftDeleteDeleteClause) ModifyStatement ¶ added in v1.24.1
func (sd SoftDeleteDeleteClause) ModifyStatement(stmt *Statement)
func (SoftDeleteDeleteClause) Name ¶ added in v1.24.1
func (sd SoftDeleteDeleteClause) Name() string
type SoftDeleteQueryClause ¶ added in v1.24.1
func (SoftDeleteQueryClause) Build ¶ added in v1.24.1
func (sd SoftDeleteQueryClause) Build(clause.Builder)
func (SoftDeleteQueryClause) MergeClause ¶ added in v1.24.1
func (sd SoftDeleteQueryClause) MergeClause(*clause.Clause)
func (SoftDeleteQueryClause) ModifyStatement ¶ added in v1.24.1
func (sd SoftDeleteQueryClause) ModifyStatement(stmt *Statement)
func (SoftDeleteQueryClause) Name ¶ added in v1.24.1
func (sd SoftDeleteQueryClause) Name() string
type SoftDeleteUpdateClause ¶ added in v1.24.1
func (SoftDeleteUpdateClause) Build ¶ added in v1.24.1
func (sd SoftDeleteUpdateClause) Build(clause.Builder)
func (SoftDeleteUpdateClause) MergeClause ¶ added in v1.24.1
func (sd SoftDeleteUpdateClause) MergeClause(*clause.Clause)
func (SoftDeleteUpdateClause) ModifyStatement ¶ added in v1.24.1
func (sd SoftDeleteUpdateClause) ModifyStatement(stmt *Statement)
func (SoftDeleteUpdateClause) Name ¶ added in v1.24.1
func (sd SoftDeleteUpdateClause) Name() string
type Statement ¶ added in v1.24.1
type Statement struct { *DB TableExpr *clause.Expr Table string Model interface{} Unscoped bool Dest interface{} ReflectValue reflect.Value Clauses map[string]clause.Clause BuildClauses []string Distinct bool Selects []string // selected columns Omits []string // omit columns Joins []join Preloads map[string][]interface{} Settings sync.Map ConnPool ConnPool Schema *schema.Schema Context context.Context RaiseErrorOnNotFound bool SkipHooks bool SQL strings.Builder Vars []interface{} CurDestIndex int // contains filtered or unexported fields }
Statement statement
func (*Statement) AddClauseIfNotExists ¶ added in v1.24.1
AddClauseIfNotExists add clause if not exists
func (*Statement) BuildCondition ¶ added in v1.24.1
func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []clause.Expression
BuildCondition build condition
func (*Statement) ParseWithSpecialTableName ¶ added in v1.24.1
func (*Statement) SelectAndOmitColumns ¶ added in v1.24.1
func (stmt *Statement) SelectAndOmitColumns(requireCreate, requireUpdate bool) (map[string]bool, bool)
SelectAndOmitColumns get select and omit columns, select -> true, omit -> false
func (*Statement) SetColumn ¶ added in v1.24.1
SetColumn set column's value
stmt.SetColumn("Name", "jinzhu") // Hooks Method stmt.SetColumn("Name", "jinzhu", true) // Callbacks Method
func (*Statement) WriteQuoted ¶ added in v1.24.1
func (stmt *Statement) WriteQuoted(value interface{})
WriteQuoted write quoted value
type StatementModifier ¶ added in v1.24.1
type StatementModifier interface {
ModifyStatement(*Statement)
}
StatementModifier statement modifier interface
type Tx ¶ added in v1.24.1
type Tx interface { ConnPool TxCommitter StmtContext(ctx context.Context, stmt *sql.Stmt) *sql.Stmt }
Tx sql.Tx interface
type TxBeginner ¶ added in v1.24.1
TxBeginner tx beginner
type TxCommitter ¶ added in v1.24.1
TxCommitter tx committer
type ViewOption ¶ added in v1.24.1
ViewOption view option