Documentation ¶
Index ¶
- Variables
- type Config
- type DB
- type Gorm
- type Logger
- func (*Logger) Error(ctx context.Context, tmpl string, args ...interface{})
- func (*Logger) Info(ctx context.Context, tmpl string, args ...interface{})
- func (l *Logger) LogMode(gormlog.LogLevel) gormlog.Interface
- func (*Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (*Logger) Warn(ctx context.Context, tmpl string, args ...interface{})
- type OptionFunc
- func WithClauseBuilders(builders map[string]clause.ClauseBuilder) OptionFunc
- func WithConnPool(pool gorm.ConnPool) OptionFunc
- func WithDialector(dial gorm.Dialector) OptionFunc
- func WithNamingStrategy(namer schema.Namer) OptionFunc
- func WithNamingStrategyNameReplacer(replacer schema.Replacer) OptionFunc
- func WithNowFunc(fn func() time.Time) OptionFunc
- func WithPlugins(plugins map[string]gorm.Plugin) OptionFunc
- type Session
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Expr = gorm.Expr Scan = gorm.Scan )
View Source
var ( // ErrRecordNotFound record not found error ErrRecordNotFound = gorm.ErrRecordNotFound // ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = gorm.ErrInvalidTransaction // ErrNotImplemented not implemented ErrNotImplemented = gorm.ErrNotImplemented // ErrMissingWhereClause missing where clause ErrMissingWhereClause = gorm.ErrMissingWhereClause // ErrUnsupportedRelation unsupported relations ErrUnsupportedRelation = gorm.ErrUnsupportedRelation // ErrPrimaryKeyRequired primary keys required ErrPrimaryKeyRequired = gorm.ErrPrimaryKeyRequired // ErrModelValueRequired model value required ErrModelValueRequired = gorm.ErrModelValueRequired // ErrInvalidData unsupported data ErrInvalidData = gorm.ErrInvalidData // ErrUnsupportedDriver unsupported driver ErrUnsupportedDriver = gorm.ErrUnsupportedDriver // ErrRegistered registered ErrRegistered = gorm.ErrRegistered // ErrInvalidField invalid field ErrInvalidField = gorm.ErrInvalidField // ErrEmptySlice empty slice found ErrEmptySlice = gorm.ErrEmptySlice // ErrDryRunModeUnsupported dry run mode unsupported ErrDryRunModeUnsupported = gorm.ErrDryRunModeUnsupported // ErrInvalidDB invalid db ErrInvalidDB = gorm.ErrInvalidDB // ErrInvalidValue invalid value ErrInvalidValue = gorm.ErrInvalidValue // ErrInvalidValueOfLength invalid values do not match length ErrInvalidValueOfLength = gorm.ErrInvalidValueOfLength )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Driver string `config:"driver" desc:"SQLDrivers: https://github.com/golang/go/wiki/SQLDrivers"` DSN string `config:"dsn" desc:"Data Source Name"` MaxIdleTime time.Duration `` /* 175-byte string literal not displayed */ MaxLifeTime time.Duration `` /* 171-byte string literal not displayed */ MaxIdleConns int `` /* 299-byte string literal not displayed */ MaxOpenConns int `` /* 358-byte string literal not displayed */ SkipDefaultTransaction bool `config:"skipDefaultTransaction"` DryRun bool `config:"dryRun"` PrepareStmt bool `config:"prepareStmt"` DisableNestedTransaction bool `config:"disableNestedTransaction"` AllowGlobalUpdate bool `config:"allowGlobalUpdate"` DisableAutomaticPing bool `config:"disableAutomaticPing"` DisableForeignKeyConstraintWhenMigrating bool `config:"disableForeignKeyConstraintWhenMigrating"` QueryFields bool `config:"queryFields"` CreateBatchSize int `config:"createBatchSize"` NamingStrategy schema.Namer `config:"-"` NamingStrategyTablePrefix string `config:"namingStrategyTablePrefix"` NamingStrategySingularTable bool `config:"namingStrategySingularTable"` NamingStrategyNoLowerCase bool `config:"namingStrategyNoLowerCase"` NamingStrategyNameReplacer schema.Replacer `config:"-"` NowFunc func() time.Time `config:"-"` ConnPool gorm.ConnPool `config:"-"` ClauseBuilders map[string]clause.ClauseBuilder `config:"-"` Plugins map[string]gorm.Plugin `config:"-"` // contains filtered or unexported fields }
Config 配置
type OptionFunc ¶
type OptionFunc func(*Config)
OptionFunc 选项信息
func WithClauseBuilders ¶
func WithClauseBuilders(builders map[string]clause.ClauseBuilder) OptionFunc
func WithConnPool ¶
func WithConnPool(pool gorm.ConnPool) OptionFunc
func WithDialector ¶
func WithDialector(dial gorm.Dialector) OptionFunc
func WithNamingStrategy ¶
func WithNamingStrategy(namer schema.Namer) OptionFunc
func WithNamingStrategyNameReplacer ¶
func WithNamingStrategyNameReplacer(replacer schema.Replacer) OptionFunc
func WithNowFunc ¶
func WithNowFunc(fn func() time.Time) OptionFunc
func WithPlugins ¶
func WithPlugins(plugins map[string]gorm.Plugin) OptionFunc
Click to show internal directories.
Click to hide internal directories.