Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRow = sql.ErrNoRows ErrRecordNotFound = gorm.ErrRecordNotFound ErrCantStartTransaction = gorm.ErrCantStartTransaction ErrInvalidSQL = gorm.ErrInvalidSQL ErrInvalidTransaction = gorm.ErrInvalidTransaction ErrUnaddressable = gorm.ErrUnaddressable )
Functions ¶
func InitGorm ¶
func InitGorm(c *MySQLConfig) (db *gorm.DB)
func InitXorm ¶
func InitXorm(c *MySQLConfig) (db *xorm.Engine)
Types ¶
type MySQLConfig ¶
type MySQLConfig struct { DSN string // data source name. MaxOpenConn int // pool, e.g:10 MaxIdleConn int // pool, e.g:100 MaxConnTimeout xtime.Duration // connect max life time. e.g:10s、2m、1m10s ShowSQL bool }
MySQLConfig mysql config.
type Redis ¶
type Redis struct {
Redis *redis.Client
}
func InitRedis ¶
func InitRedis(c *RedisConfig) (r *Redis)
type RedisCluster ¶
type RedisCluster struct {
Redis *redis.ClusterClient
}
func InitRedisCluster ¶
func InitRedisCluster(c *RedisConfig) (rc *RedisCluster)
func (*RedisCluster) Transaction ¶
func (r *RedisCluster) Transaction(ctx context.Context, fc func(tx redis.Pipeliner) error) error
Click to show internal directories.
Click to hide internal directories.