Documentation ¶
Index ¶
- Constants
- Variables
- type Model
- func (m *Model) AllFields(withBackQuote bool) string
- func (m *Model) Count(where []interface{}) (count int64)
- func (m *Model) Create(value interface{}) (interface{}, error)
- func (m *Model) DebugLogger() logger.Interface
- func (m *Model) Delete(where []interface{}) error
- func (m *Model) Dialector(dialect *types.MysqlDialect) gorm.Dialector
- func (m *Model) Find(des interface{}, where []interface{}, fields interface{}, order interface{}, ...)
- func (m *Model) FindByPrimaryKey(des interface{}, value interface{}, fields interface{})
- func (m *Model) FindOne(des interface{}, where []interface{}, fields interface{}, order interface{})
- func (m *Model) GetPrimaryKeyFieldName() (string, error)
- func (m *Model) NewLogger(filename string, args ...interface{}) logger.Interface
- func (m *Model) NewMysql(collector *types.DBCollector, dialect *types.MysqlDialect, options ...Option) (*gorm.DB, error)
- func (m *Model) ParseDSN(dialect *types.MysqlDialect) string
- func (m *Model) Save(value interface{}, args ...interface{}) (interface{}, error)
- func (m *Model) SaveOrUpdate(value interface{}, primaryKey int, updateFields interface{}) (interface{}, error)
- func (m *Model) Session() *gorm.DB
- func (m *Model) Update(where []interface{}, value interface{}) error
- func (*Model) WithConnMaxIdleTime(t time.Duration) Option
- func (*Model) WithConnMaxLifeTime(t time.Duration) Option
- func (m *Model) WithDebugLogger() Option
- func (*Model) WithLogger(args ...interface{}) Option
- func (*Model) WithMaxIdleConns(i int) Option
- func (*Model) WithMaxOpenConns(i int) Option
- type Option
Constants ¶
View Source
const ( DefaultCharset = "utf8mb4" DefaultLoc = "Local" DefaultParseTime = "true" DefaultMaxAllowedPacket = "0" DefaultTimeout = "15s" )
View Source
const ( DefaultLogLevel = logger.Warn DefaultSlowThreshold = 500 * time.Millisecond )
View Source
const ( DefaultMaxIdleConns = 5 DefaultMaxOpenConns = 50 DefaultConnMaxIdleTime = 5 * time.Minute DefaultConnMaxLifeTime = 10 * time.Minute )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Model ¶
func (*Model) DebugLogger ¶ added in v1.3.40
func (*Model) Dialector ¶ added in v1.2.0
func (m *Model) Dialector(dialect *types.MysqlDialect) gorm.Dialector
func (*Model) FindByPrimaryKey ¶ added in v1.3.40
func (m *Model) FindByPrimaryKey(des interface{}, value interface{}, fields interface{})
func (*Model) FindOne ¶
func (m *Model) FindOne(des interface{}, where []interface{}, fields interface{}, order interface{})
func (*Model) GetPrimaryKeyFieldName ¶ added in v1.3.40
func (*Model) NewMysql ¶
func (m *Model) NewMysql(collector *types.DBCollector, dialect *types.MysqlDialect, options ...Option) (*gorm.DB, error)
func (*Model) ParseDSN ¶ added in v1.2.0
func (m *Model) ParseDSN(dialect *types.MysqlDialect) string
func (*Model) SaveOrUpdate ¶ added in v1.1.6
func (*Model) WithConnMaxIdleTime ¶ added in v1.3.40
func (*Model) WithConnMaxLifeTime ¶ added in v1.3.40
func (*Model) WithDebugLogger ¶ added in v1.3.40
func (*Model) WithLogger ¶ added in v1.3.40
func (*Model) WithMaxIdleConns ¶ added in v1.3.40
func (*Model) WithMaxOpenConns ¶ added in v1.3.40
Click to show internal directories.
Click to hide internal directories.