Documentation ¶
Index ¶
- type LoggingHook
- func (h *LoggingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (h *LoggingHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (h *LoggingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (h *LoggingHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- type MongoConfig
- type MongoDb
- type MongoSession
- func (session *MongoSession) Count(tableName string, query bson.M) (int64, error)
- func (session *MongoSession) CreateIndexes(tableName string, keyNames []string) error
- func (session *MongoSession) CreateOneIndex(tableName string, keyName string) error
- func (session *MongoSession) DeleteById(tableName string, id string) error
- func (session *MongoSession) DeleteMany(tableName string, query interface{}) (*qmgo.DeleteResult, error)
- func (session *MongoSession) DeleteOne(tableName string, query interface{}) error
- func (session *MongoSession) DoTransaction(callback func(sessCtx context.Context) (interface{}, error)) (interface{}, error)
- func (session *MongoSession) Find(tableName string, params bson.M, selectParams bson.M, limit int64, skip int64, ...) error
- func (session *MongoSession) FindById(tableName string, id string, data interface{}) error
- func (session *MongoSession) FindOne(tableName string, params bson.M, selectParams bson.M, data interface{}) error
- func (session *MongoSession) GetCollection(tableName string) *qmgo.Collection
- func (session *MongoSession) InsertMany(tableName string, params []interface{}) ([]string, error)
- func (session *MongoSession) InsertOne(tableName string, updateInfo interface{}) (string, error)
- func (session *MongoSession) SetLogger(log *logger.Logger)
- func (session *MongoSession) SetTimeOut(timeout time.Duration)
- func (session *MongoSession) UpdateById(tableName string, id string, params interface{}) error
- func (session *MongoSession) UpdateMany(tableName string, query interface{}, params interface{}) error
- func (session *MongoSession) UpdateOne(tableName string, query interface{}, params interface{}) error
- func (session *MongoSession) Upsert(tableName string, filter interface{}, params interface{}) (*qmgo.UpdateResult, error)
- func (session *MongoSession) UpsertById(tableName string, id string, params interface{}) (*qmgo.UpdateResult, error)
- type MysqlDb
- type MysqlDbConfig
- type MysqlSession
- type RedisConfig
- type RedisDb
- func (r *RedisDb) BLPop(ctx context.Context, timeout time.Duration, keys ...string) ([]string, error)
- func (r *RedisDb) Client() *redis.Client
- func (r *RedisDb) Close() error
- func (r *RedisDb) Del(ctx context.Context, keys ...string) (int64, error)
- func (r *RedisDb) Eval(ctx context.Context, script string, keys []string, args ...interface{}) (interface{}, error)
- func (r *RedisDb) Exists(ctx context.Context, keys ...string) (int64, error)
- func (r *RedisDb) Expire(ctx context.Context, key string, expire time.Duration) error
- func (r *RedisDb) GetByte(ctx context.Context, key string) ([]byte, error)
- func (r *RedisDb) GetFloat(ctx context.Context, key string) (float64, error)
- func (r *RedisDb) GetInt(ctx context.Context, key string) (int, error)
- func (r *RedisDb) GetScan(ctx context.Context, key string, value interface{}) error
- func (r *RedisDb) GetString(ctx context.Context, key string) (string, error)
- func (r *RedisDb) HDel(ctx context.Context, key string, fields ...string) (int64, error)
- func (r *RedisDb) HGet(ctx context.Context, key, field string) (string, error)
- func (r *RedisDb) HGetAll(ctx context.Context, key string) (map[string]string, error)
- func (r *RedisDb) HIncrBy(ctx context.Context, key, field string, value int64) (int64, error)
- func (r *RedisDb) HIncrByFloat(ctx context.Context, key, field string, value float64) (float64, error)
- func (r *RedisDb) HMGet(ctx context.Context, key string, fields []string) ([]interface{}, error)
- func (r *RedisDb) HSet(ctx context.Context, key string, values ...interface{}) (int64, error)
- func (r *RedisDb) Incr(ctx context.Context, key string) (int64, error)
- func (r *RedisDb) IncrBy(ctx context.Context, key string, value int64) (int64, error)
- func (r *RedisDb) IncrByFloat(ctx context.Context, key string, value float64) (float64, error)
- func (r *RedisDb) LPop(ctx context.Context, key string, value interface{}) error
- func (r *RedisDb) LPush(ctx context.Context, key string, values ...interface{}) (int64, error)
- func (r *RedisDb) PSubscribe(ctx context.Context, channels ...string) *redis.PubSub
- func (r *RedisDb) Ping(ctx context.Context) error
- func (r *RedisDb) Publish(ctx context.Context, channel string, message interface{}) error
- func (r *RedisDb) RPop(ctx context.Context, key string, value interface{}) error
- func (r *RedisDb) RPush(ctx context.Context, key string, values ...interface{}) (int64, error)
- func (r *RedisDb) Set(ctx context.Context, key string, value interface{}, expire time.Duration) *redis.StatusCmd
- func (r *RedisDb) SetLogger(log *logger.Logger)
- func (r *RedisDb) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
- func (r *RedisDb) Subscribe(ctx context.Context) *redis.PubSub
- func (r *RedisDb) ZAdd(ctx context.Context, key string, members ...*redis.Z) (int64, error)
- func (r *RedisDb) ZCard(ctx context.Context, key string) (int64, error)
- func (r *RedisDb) ZRange(ctx context.Context, key string, min, max int64) ([]string, error)
- func (r *RedisDb) ZRangeByScore(ctx context.Context, key string, min, max int64, offset, count int64) ([]string, error)
- func (r *RedisDb) ZRemRangeByRank(ctx context.Context, key string, start, stop int64) (int64, error)
- func (r *RedisDb) ZRemRangeByScore(ctx context.Context, key string, min, max int64) (int64, error)
- type RedisSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggingHook ¶
func NewLoggingHook ¶
func NewLoggingHook(log *logger.Logger) *LoggingHook
func (*LoggingHook) AfterProcess ¶
func (h *LoggingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
func (*LoggingHook) AfterProcessPipeline ¶
func (h *LoggingHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
func (*LoggingHook) BeforeProcess ¶
func (*LoggingHook) BeforeProcessPipeline ¶
type MongoConfig ¶
type MongoConfig struct { Uri string `json:"uri"` Database string `json:"database"` Coll string `json:"coll"` ConnectTimeoutMS *int64 `json:"connectTimeoutMS"` MaxPoolSize *uint64 `json:"maxPoolSize"` MinPoolSize *uint64 `json:"minPoolSize"` SocketTimeoutMS *int64 `json:"socketTimeoutMS"` ReadPreference *qmgo.ReadPref `json:"readPreference"` Auth *qmgo.Credential `json:"auth"` }
type MongoDb ¶
type MongoDb struct {
*MongoSession
}
type MongoSession ¶
type MongoSession struct { Uri string Client *qmgo.Client Db *qmgo.Database DbName string // contains filtered or unexported fields }
func NewMongoSession ¶
func NewMongoSession(uri string, database string) (*MongoSession, error)
func (*MongoSession) CreateIndexes ¶
func (session *MongoSession) CreateIndexes(tableName string, keyNames []string) error
CreateIndexes 创建多个索引
func (*MongoSession) CreateOneIndex ¶
func (session *MongoSession) CreateOneIndex(tableName string, keyName string) error
CreateOneIndex 创建单个索引
func (*MongoSession) DeleteById ¶
func (session *MongoSession) DeleteById(tableName string, id string) error
DeleteById 根据Id删除
func (*MongoSession) DeleteMany ¶
func (session *MongoSession) DeleteMany(tableName string, query interface{}) (*qmgo.DeleteResult, error)
DeleteMany 删除多个
func (*MongoSession) DeleteOne ¶
func (session *MongoSession) DeleteOne(tableName string, query interface{}) error
DeleteOne 根据条件删除
func (*MongoSession) DoTransaction ¶
func (session *MongoSession) DoTransaction(callback func(sessCtx context.Context) (interface{}, error)) (interface{}, error)
DoTransaction 事务
func (*MongoSession) Find ¶
func (session *MongoSession) Find(tableName string, params bson.M, selectParams bson.M, limit int64, skip int64, sort []string, ret interface{}) error
Find 查询多个
func (*MongoSession) FindById ¶
func (session *MongoSession) FindById(tableName string, id string, data interface{}) error
FindById 查询一个
func (*MongoSession) FindOne ¶
func (session *MongoSession) FindOne(tableName string, params bson.M, selectParams bson.M, data interface{}) error
FindOne 查询一个
func (*MongoSession) GetCollection ¶
func (session *MongoSession) GetCollection(tableName string) *qmgo.Collection
GetCollection 获取collection
func (*MongoSession) InsertMany ¶
func (session *MongoSession) InsertMany(tableName string, params []interface{}) ([]string, error)
InsertMany 插入多个
func (*MongoSession) InsertOne ¶
func (session *MongoSession) InsertOne(tableName string, updateInfo interface{}) (string, error)
InsertOne 插入一个
func (*MongoSession) SetLogger ¶
func (session *MongoSession) SetLogger(log *logger.Logger)
func (*MongoSession) SetTimeOut ¶
func (session *MongoSession) SetTimeOut(timeout time.Duration)
SetTimeOut 设置超时
func (*MongoSession) UpdateById ¶
func (session *MongoSession) UpdateById(tableName string, id string, params interface{}) error
UpdateById 根据id更新
func (*MongoSession) UpdateMany ¶
func (session *MongoSession) UpdateMany(tableName string, query interface{}, params interface{}) error
UpdateMany 更新多个文档
func (*MongoSession) UpdateOne ¶
func (session *MongoSession) UpdateOne(tableName string, query interface{}, params interface{}) error
UpdateOne 更新单个
func (*MongoSession) Upsert ¶
func (session *MongoSession) Upsert(tableName string, filter interface{}, params interface{}) (*qmgo.UpdateResult, error)
func (*MongoSession) UpsertById ¶
func (session *MongoSession) UpsertById(tableName string, id string, params interface{}) (*qmgo.UpdateResult, error)
type MysqlDb ¶
type MysqlDb struct {
// contains filtered or unexported fields
}
func NewMysqlDb ¶
func (*MysqlDb) AutoMigrate ¶
type MysqlSession ¶
type MysqlSession struct {
// contains filtered or unexported fields
}
func NewMysqlSession ¶
func NewMysqlSession(dbName, host string, port int, username, password, config string) (*MysqlSession, error)
type RedisConfig ¶
type RedisConfig struct {
Opt *redis.Options
}
type RedisDb ¶
type RedisDb struct {
// contains filtered or unexported fields
}
func (*RedisDb) HIncrByFloat ¶
func (*RedisDb) IncrByFloat ¶
func (*RedisDb) PSubscribe ¶
func (*RedisDb) ZRangeByScore ¶
func (*RedisDb) ZRemRangeByRank ¶
type RedisSession ¶
type RedisSession struct { Id int // contains filtered or unexported fields }
func NewRedisSession ¶
func NewRedisSession(opt *redis.Options) (*RedisSession, error)
func (*RedisSession) Db ¶
func (db *RedisSession) Db() *RedisDb
Click to show internal directories.
Click to hide internal directories.