Documentation ¶
Index ¶
- func InitMongoClient(cfg *cfgargs.SrvConfig) error
- func InitRedisClient(cfg *cfgargs.SrvConfig)
- func IsNoDocumentError(err error) bool
- func IsNotExistError(err error) bool
- type MongoClient
- func (m *MongoClient) DeleteMany(collection string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (m *MongoClient) DeleteOne(collection string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (m *MongoClient) Find(collection string, val, filter interface{}, opts ...*options.FindOptions) error
- func (m *MongoClient) FindOne(collection string, val, filter interface{}, opts ...*options.FindOneOptions) error
- func (m *MongoClient) FindOneAndDelete(collection string, val, filter interface{}, ...) error
- func (m *MongoClient) FindOneAndReplace(collection string, val, filter, replacement interface{}, ...) error
- func (m *MongoClient) FindOneAndUpdate(collection string, val, filter, update interface{}, ...) error
- func (m *MongoClient) GetAllCollectionNames() ([]string, error)
- func (m *MongoClient) GetAllDatabaseNames() ([]string, error)
- func (m *MongoClient) GetCollectionHandle(collection string) *mongo.Collection
- func (m *MongoClient) InsertMany(collection string, documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func (m *MongoClient) InsertOne(collection string, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (m *MongoClient) ReplaceOne(collection string, filter interface{}, replacement interface{}, ...) (*mongo.UpdateResult, error)
- func (m *MongoClient) UpdateByID(collection string, id interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func (m *MongoClient) UpdateMany(collection string, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func (m *MongoClient) UpdateOne(collection string, filter, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- type RedisClient
- func (r *RedisClient) DelOne(key string) (result int64, err error)
- func (r *RedisClient) Expire(key string, expiration time.Duration) (result bool, err error)
- func (r *RedisClient) Get(key string) (val string, err error)
- func (r *RedisClient) GetOne(key string) (string, error)
- func (r *RedisClient) HDel(key string, fields ...string) (int64, error)
- func (r *RedisClient) HGet(key string, field string) (string, error)
- func (r *RedisClient) HGetAll(key string) (map[string]string, error)
- func (r *RedisClient) HKeys(key string) ([]string, error)
- func (r *RedisClient) HSet(key string, field string, val interface{}) (int64, error)
- func (r *RedisClient) Incr(key string) (result int64, err error)
- func (r *RedisClient) Keys(pattern string) (vals []string, err error)
- func (r *RedisClient) LLen(key string) (result int64, err error)
- func (r *RedisClient) LPush(key string, val string) (result int64, err error)
- func (r *RedisClient) LRange(key string, start int64, end int64) (result []string, err error)
- func (r *RedisClient) LTrim(key string, start int64, end int64) (result string, err error)
- func (r *RedisClient) MGet(keys []string) (vals []interface{}, err error)
- func (r *RedisClient) MSet(vals []interface{}) (string, error)
- func (r *RedisClient) Publish(ch string, msg string) (result int64, err error)
- func (r *RedisClient) RPop(key string) (result string, err error)
- func (r *RedisClient) SMembers(key string) (result []string, err error)
- func (r *RedisClient) SRem(key string, members []interface{}) (result int64, err error)
- func (r *RedisClient) Set(key string, val string, expire int) (result string, err error)
- func (r *RedisClient) SetAdd(key string, vals []interface{}) (result int64, err error)
- func (r *RedisClient) SetNx(key string, val string, expire int) (result bool, err error)
- func (r *RedisClient) TTL(key string) (result time.Duration, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMongoClient ¶
func InitRedisClient ¶
Types ¶
type MongoClient ¶
type MongoClient struct {
// contains filtered or unexported fields
}
MongoClient ..
func NewMongoClient ¶
func NewMongoClient(host, port, db, user, password string, panicIfDisconnect bool) (mongoClient *MongoClient, err error)
NewMongoClient ...
func (*MongoClient) DeleteMany ¶
func (m *MongoClient) DeleteMany(collection string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
DeleteMany ...
func (*MongoClient) DeleteOne ¶
func (m *MongoClient) DeleteOne(collection string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
DeleteOne ...
func (*MongoClient) Find ¶
func (m *MongoClient) Find(collection string, val, filter interface{}, opts ...*options.FindOptions) error
Find ...
func (*MongoClient) FindOne ¶
func (m *MongoClient) FindOne(collection string, val, filter interface{}, opts ...*options.FindOneOptions) error
FindOne ...
func (*MongoClient) FindOneAndDelete ¶
func (m *MongoClient) FindOneAndDelete(collection string, val, filter interface{}, opts ...*options.FindOneAndDeleteOptions) error
FindOneAndDelete ...
func (*MongoClient) FindOneAndReplace ¶
func (m *MongoClient) FindOneAndReplace(collection string, val, filter, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) error
FindOneAndReplace ...
func (*MongoClient) FindOneAndUpdate ¶
func (m *MongoClient) FindOneAndUpdate(collection string, val, filter, update interface{}, opts ...*options.FindOneAndUpdateOptions) error
FindOneAndUpdate ...
func (*MongoClient) GetAllCollectionNames ¶
func (m *MongoClient) GetAllCollectionNames() ([]string, error)
GetAllCollectionNames ...
func (*MongoClient) GetAllDatabaseNames ¶
func (m *MongoClient) GetAllDatabaseNames() ([]string, error)
GetAllDatabaseNames ...
func (*MongoClient) GetCollectionHandle ¶
func (m *MongoClient) GetCollectionHandle(collection string) *mongo.Collection
GetCollectionHandle ...
func (*MongoClient) InsertMany ¶
func (m *MongoClient) InsertMany(collection string, documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
InsertMany ...
func (*MongoClient) InsertOne ¶
func (m *MongoClient) InsertOne(collection string, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
InsertOne ...
func (*MongoClient) ReplaceOne ¶
func (m *MongoClient) ReplaceOne(collection string, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
ReplaceOne ...
func (*MongoClient) UpdateByID ¶
func (m *MongoClient) UpdateByID(collection string, id interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateByID ...
func (*MongoClient) UpdateMany ¶
func (m *MongoClient) UpdateMany(collection string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateMany ...
func (*MongoClient) UpdateOne ¶
func (m *MongoClient) UpdateOne(collection string, filter, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateOne ...
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient ...
func NewRedisClient ¶
func NewRedisClient(addr string, password string, db int, panicIfDisconnect bool) *RedisClient
NewRedisClient ...
func (*RedisClient) DelOne ¶
func (r *RedisClient) DelOne(key string) (result int64, err error)
DelOne ...
func (*RedisClient) Get ¶
func (r *RedisClient) Get(key string) (val string, err error)
Get Batch Get
func (*RedisClient) HDel ¶
func (r *RedisClient) HDel(key string, fields ...string) (int64, error)
HDel ...
func (*RedisClient) HGet ¶
func (r *RedisClient) HGet(key string, field string) (string, error)
HGet ...
func (*RedisClient) HGetAll ¶
func (r *RedisClient) HGetAll(key string) (map[string]string, error)
HGetAll ...
func (*RedisClient) HSet ¶
func (r *RedisClient) HSet(key string, field string, val interface{}) (int64, error)
HSet ...
func (*RedisClient) Incr ¶
func (r *RedisClient) Incr(key string) (result int64, err error)
Incr ...
func (*RedisClient) Keys ¶
func (r *RedisClient) Keys(pattern string) (vals []string, err error)
Keys FuzzyQuery
func (*RedisClient) LLen ¶
func (r *RedisClient) LLen(key string) (result int64, err error)
LLen ...
func (*RedisClient) LPush ¶
func (r *RedisClient) LPush(key string, val string) (result int64, err error)
LPush ...
func (*RedisClient) MGet ¶
func (r *RedisClient) MGet(keys []string) (vals []interface{}, err error)
MGet ...
func (*RedisClient) MSet ¶
func (r *RedisClient) MSet(vals []interface{}) (string, error)
MSet Batch Set
func (*RedisClient) Publish ¶
func (r *RedisClient) Publish(ch string, msg string) (result int64, err error)
Publish ...
func (*RedisClient) RPop ¶
func (r *RedisClient) RPop(key string) (result string, err error)
RPop ...
func (*RedisClient) SMembers ¶
func (r *RedisClient) SMembers(key string) (result []string, err error)
SMembers ...
func (*RedisClient) SRem ¶
func (r *RedisClient) SRem(key string, members []interface{}) (result int64, err error)
SRem ...
func (*RedisClient) SetAdd ¶
func (r *RedisClient) SetAdd(key string, vals []interface{}) (result int64, err error)
SetAdd ...
Click to show internal directories.
Click to hide internal directories.