Documentation
¶
Overview ¶
@auther fenglei
@auther fenglei
@auther fenglei
@auther fenglei
@auther fenglei
@auther fenglei
@auther fenglei
@auther fenglei
Index ¶
- Variables
- func CloseMongo(mongo *mongo.Client) error
- func CloseMySQL(db *gorm.DB) error
- func CloseRedis(redis *redis.Client) error
- func GenMySQL(dns string, tables ...string) error
- func GormError(err error) bool
- func GormToMap(v any) map[string]interface{}
- func GormWhere(wheres map[string]map[string]interface{}) func(db *gorm.DB) *gorm.DB
- func MongoPage(p *Pages) (findOptions options.FindOptions)
- func NewMongo(opts *MongoOptions) (*mongo.Client, error)
- func NewMySQL(opts *MySQLOptions) (*gorm.DB, error)
- func NewRedis(opts *RedisOptions) (*redis.Client, error)
- func NewRedisDao(redis *redis.Client) *redisDao
- func Paginate(page int, pageSize int) func(db *gorm.DB) *gorm.DB
- func PaginatePage(p *Pages) func(db *gorm.DB) *gorm.DB
- type MongoOptions
- type MySQLOptions
- type Pages
- type RedisOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var DBDefaultPageSize = 10
设置缺省分页
View Source
var RedisDao = new(redisDao)
Functions ¶
func CloseMongo ¶ added in v0.1.5
func CloseMySQL ¶
func CloseRedis ¶ added in v0.1.6
func CloseRedis(redis *redis.Client) error
func MongoPage ¶ added in v0.1.5
func MongoPage(p *Pages) (findOptions options.FindOptions)
func NewMongo ¶ added in v0.1.5
func NewMongo(opts *MongoOptions) (*mongo.Client, error)
NewMySQL create a new gorm db instance with the given options.
func NewMySQL ¶
func NewMySQL(opts *MySQLOptions) (*gorm.DB, error)
NewMySQL create a new gorm db instance with the given options.
func NewRedis ¶ added in v0.1.5
func NewRedis(opts *RedisOptions) (*redis.Client, error)
func NewRedisDao ¶ added in v0.1.5
func NewRedisDao(redis *redis.Client) *redisDao
func PaginatePage ¶ added in v0.1.5
Types ¶
type MongoOptions ¶ added in v0.1.5
type MySQLOptions ¶
type MySQLOptions struct { DSN string MaxIdleConnections int MaxOpenConnections int MaxConnectionLifeTime time.Duration // +optional Logger logger.Interface }
MySQLOptions defines options for mysql database.
type RedisOptions ¶ added in v0.1.5
type RedisOptions struct {
DSN string
}
Click to show internal directories.
Click to hide internal directories.