Documentation ¶
Index ¶
- Variables
- type DBService
- func (dbs *DBService) GetNewTableID(ctx *zservice.Context, genID func() uint32, ...) (uint32, *zservice.Error)
- func (dbs *DBService) GetTableValue(ctx *zservice.Context, opt GetTableValueOption) *zservice.Error
- func (dbs *DBService) HasTableValue(ctx *zservice.Context, opt HasTableValueOption) (bool, *zservice.Error)
- func (dbs *DBService) IsNotFoundErr(e error) bool
- func (dbs *DBService) SaveTableValue(ctx *zservice.Context, opt SaveTableValueOption) *zservice.Error
- func (dbs *DBService) SyncTableCache(ctx *zservice.Context, tabArr any, getRK func(v any) string) *zservice.Error
- type DBServiceOption
- type GetTableValueOption
- type GoRedisEX
- func (r *GoRedisEX) AddKeyPrefix(key string) string
- func (r *GoRedisEX) AddkeyPrefixs(key ...string) []string
- func (r *GoRedisEX) BLMPop(ctx context.Context, timeout time.Duration, direction string, count int64, ...) *redis.KeyValuesCmd
- func (r *GoRedisEX) BLMPopCtx(ctx context.Context, timeout time.Duration, direction string, count int64, ...) *redis.KeyValuesCmd
- func (r *GoRedisEX) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) BLPopCtx(ctx context.Context, timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) BRPop(ctx context.Context, timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) BRPopCtx(ctx context.Context, timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *redis.StringCmd
- func (r *GoRedisEX) BRPopLPushCtx(ctx context.Context, source, destination string, timeout time.Duration) *redis.StringCmd
- func (r *GoRedisEX) Client() *redis.Client
- func (r *GoRedisEX) Copy(key, newkey string, db int, replace bool) *redis.IntCmd
- func (r *GoRedisEX) CopyCtx(ctx context.Context, key, newkey string, db int, replace bool) *redis.IntCmd
- func (r *GoRedisEX) Del(keys ...string) *redis.IntCmd
- func (r *GoRedisEX) DelCtx(ctx context.Context, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) Dump(key string) *redis.StringCmd
- func (r *GoRedisEX) DumpCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) Exists(keys ...string) *redis.IntCmd
- func (r *GoRedisEX) ExistsCtx(ctx context.Context, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) Expire(key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireAt(key string, expiration time.Time) *redis.BoolCmd
- func (r *GoRedisEX) ExpireAtCtx(ctx context.Context, key string, expiration time.Time) *redis.BoolCmd
- func (r *GoRedisEX) ExpireCtx(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireGT(key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireGTCtx(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireLT(key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireLTCtx(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireNX(key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireNXCtx(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireTime(key string) *redis.DurationCmd
- func (r *GoRedisEX) ExpireTimeCtx(ctx context.Context, key string) *redis.DurationCmd
- func (r *GoRedisEX) ExpireXX(key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) ExpireXXCtx(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) Get(key string) *redis.StringCmd
- func (r *GoRedisEX) GetCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) GetScan(key string, v any) *zservice.Error
- func (r *GoRedisEX) HDel(key string, fields ...string) *redis.IntCmd
- func (r *GoRedisEX) HDelCtx(ctx context.Context, key string, fields ...string) *redis.IntCmd
- func (r *GoRedisEX) HExists(key, field string) *redis.BoolCmd
- func (r *GoRedisEX) HExistsCtx(ctx context.Context, key, field string) *redis.BoolCmd
- func (r *GoRedisEX) HGet(key, field string) *redis.StringCmd
- func (r *GoRedisEX) HGetAll(key string) *redis.MapStringStringCmd
- func (r *GoRedisEX) HGetAllCtx(ctx context.Context, key string) *redis.MapStringStringCmd
- func (r *GoRedisEX) HGetCtx(ctx context.Context, key, field string) *redis.StringCmd
- func (r *GoRedisEX) HIncrBy(key, field string, incr int64) *redis.IntCmd
- func (r *GoRedisEX) HIncrByCtx(ctx context.Context, key, field string, incr int64) *redis.IntCmd
- func (r *GoRedisEX) HIncrByFloat(key, field string, incr float64) *redis.FloatCmd
- func (r *GoRedisEX) HIncrByFloatCtx(ctx context.Context, key, field string, incr float64) *redis.FloatCmd
- func (r *GoRedisEX) HKeys(key string) *redis.StringSliceCmd
- func (r *GoRedisEX) HKeysCtx(ctx context.Context, key string) *redis.StringSliceCmd
- func (r *GoRedisEX) HLen(key string) *redis.IntCmd
- func (r *GoRedisEX) HLenCtx(ctx context.Context, key string) *redis.IntCmd
- func (r *GoRedisEX) HMGet(key string, fields ...string) *redis.SliceCmd
- func (r *GoRedisEX) HMGetCtx(ctx context.Context, key string, fields ...string) *redis.SliceCmd
- func (r *GoRedisEX) HMSet(key string, values ...interface{}) *redis.BoolCmd
- func (r *GoRedisEX) HMSetCtx(ctx context.Context, key string, values ...interface{}) *redis.BoolCmd
- func (r *GoRedisEX) HRandField(key string, count int) *redis.StringSliceCmd
- func (r *GoRedisEX) HRandFieldCtx(ctx context.Context, key string, count int) *redis.StringSliceCmd
- func (r *GoRedisEX) HRandFieldWithValues(key string, count int) *redis.KeyValueSliceCmd
- func (r *GoRedisEX) HRandFieldWithValuesCtx(ctx context.Context, key string, count int) *redis.KeyValueSliceCmd
- func (r *GoRedisEX) HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *GoRedisEX) HScanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *GoRedisEX) HSet(key string, values ...interface{}) *redis.IntCmd
- func (r *GoRedisEX) HSetCtx(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
- func (r *GoRedisEX) HSetNX(key, field string, value interface{}) *redis.BoolCmd
- func (r *GoRedisEX) HSetNxCtx(ctx context.Context, key, field string, value interface{}) *redis.BoolCmd
- func (r *GoRedisEX) HVals(key string) *redis.StringSliceCmd
- func (r *GoRedisEX) HValsCtx(ctx context.Context, key string) *redis.StringSliceCmd
- func (r *GoRedisEX) IsNotFoundErr(e error) bool
- func (r *GoRedisEX) Keys(pattern string) *redis.StringSliceCmd
- func (r *GoRedisEX) KeysCtx(ctx context.Context, pattern string) *redis.StringSliceCmd
- func (r *GoRedisEX) LIndex(key string, index int64) *redis.StringCmd
- func (r *GoRedisEX) LIndexCtx(ctx context.Context, key string, index int64) *redis.StringCmd
- func (r *GoRedisEX) LInsert(key string, op string, pivot any, value any) *redis.IntCmd
- func (r *GoRedisEX) LInsertAfter(key string, pivot any, value any) *redis.IntCmd
- func (r *GoRedisEX) LInsertAfterCtx(ctx context.Context, key string, pivot any, value any) *redis.IntCmd
- func (r *GoRedisEX) LInsertBefore(key string, pivot any, value any) *redis.IntCmd
- func (r *GoRedisEX) LInsertBeforeCtx(ctx context.Context, key string, pivot any, value any) *redis.IntCmd
- func (r *GoRedisEX) LInsertCtx(ctx context.Context, key string, op string, pivot any, value any) *redis.IntCmd
- func (r *GoRedisEX) LLen(key string) *redis.IntCmd
- func (r *GoRedisEX) LLenCtx(ctx context.Context, key string) *redis.IntCmd
- func (r *GoRedisEX) LMPop(ctx context.Context, direction string, count int64, keys ...string) *redis.KeyValuesCmd
- func (r *GoRedisEX) LMPopCtx(ctx context.Context, direction string, count int64, keys ...string) *redis.KeyValuesCmd
- func (r *GoRedisEX) LPop(key string) *redis.StringCmd
- func (r *GoRedisEX) LPopCount(key string, count int) *redis.StringSliceCmd
- func (r *GoRedisEX) LPopCountCtx(ctx context.Context, key string, count int) *redis.StringSliceCmd
- func (r *GoRedisEX) LPopCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) LPos(key string, element string, args redis.LPosArgs) *redis.IntCmd
- func (r *GoRedisEX) LPosCount(key string, element string, count int64, args redis.LPosArgs) *redis.IntSliceCmd
- func (r *GoRedisEX) LPosCountCtx(ctx context.Context, key string, element string, count int64, ...) *redis.IntSliceCmd
- func (r *GoRedisEX) LPosCtx(ctx context.Context, key string, element string, args redis.LPosArgs) *redis.IntCmd
- func (r *GoRedisEX) LPush(key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) LPushCtx(ctx context.Context, key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) LPushX(key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) LPushXCtx(ctx context.Context, key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) LRange(key string, start, stop int64) *redis.StringSliceCmd
- func (r *GoRedisEX) LRangeCtx(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd
- func (r *GoRedisEX) LRem(key string, count int64, value interface{}) *redis.IntCmd
- func (r *GoRedisEX) LRemCtx(ctx context.Context, key string, count int64, value interface{}) *redis.IntCmd
- func (r *GoRedisEX) LSet(key string, index int64, value interface{}) *redis.StatusCmd
- func (r *GoRedisEX) LSetCtx(ctx context.Context, key string, index int64, value interface{}) *redis.StatusCmd
- func (r *GoRedisEX) LTrim(key string, start, stop int64) *redis.StatusCmd
- func (r *GoRedisEX) LTrimCtx(ctx context.Context, key string, start, stop int64) *redis.StatusCmd
- func (r *GoRedisEX) Lock(key string, timeout ...time.Duration) (func(), *zservice.Error)
- func (r *GoRedisEX) LockCtx(ctx context.Context, key string, timeout ...time.Duration) (func(), *zservice.Error)
- func (r *GoRedisEX) LockOrWait(key string, opt LockOrWaitOption) (func(), *zservice.Error)
- func (r *GoRedisEX) LockOrWaitCtx(ctx context.Context, key string, opt LockOrWaitOption) (func(), *zservice.Error)
- func (r *GoRedisEX) Migrate(host, port, key string, db int, timeout time.Duration) *redis.StatusCmd
- func (r *GoRedisEX) MigrateCtx(ctx context.Context, host, port, key string, db int, timeout time.Duration) *redis.StatusCmd
- func (r *GoRedisEX) Move(key string, db int) *redis.BoolCmd
- func (r *GoRedisEX) MoveCtx(ctx context.Context, key string, db int) *redis.BoolCmd
- func (r *GoRedisEX) ObjectEncoding(key string) *redis.StringCmd
- func (r *GoRedisEX) ObjectEncodingCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) ObjectFreq(key string) *redis.IntCmd
- func (r *GoRedisEX) ObjectFreqCtx(ctx context.Context, key string) *redis.IntCmd
- func (r *GoRedisEX) ObjectIdleTime(key string) *redis.DurationCmd
- func (r *GoRedisEX) ObjectIdleTimeCtx(ctx context.Context, key string) *redis.DurationCmd
- func (r *GoRedisEX) ObjectRefCount(key string) *redis.IntCmd
- func (r *GoRedisEX) ObjectRefCountCtx(ctx context.Context, key string) *redis.IntCmd
- func (r *GoRedisEX) PExpire(key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) PExpireAt(key string, t time.Time) *redis.BoolCmd
- func (r *GoRedisEX) PExpireAtCtx(ctx context.Context, key string, t time.Time) *redis.BoolCmd
- func (r *GoRedisEX) PExpireCtx(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) PExpireTime(key string) *redis.DurationCmd
- func (r *GoRedisEX) PExpireTimeCtx(ctx context.Context, key string) *redis.DurationCmd
- func (r *GoRedisEX) PTTL(key string) *redis.DurationCmd
- func (r *GoRedisEX) PTTLCtx(ctx context.Context, key string) *redis.DurationCmd
- func (r *GoRedisEX) Persist(key string) *redis.BoolCmd
- func (r *GoRedisEX) PersistCtx(ctx context.Context, key string) *redis.BoolCmd
- func (r *GoRedisEX) Pub(channel string, data []byte) *zservice.Error
- func (r *GoRedisEX) PubCtx(ctx *zservice.Context, channel string, data []byte) *zservice.Error
- func (r *GoRedisEX) Publish(channel string, message any) *redis.IntCmd
- func (r *GoRedisEX) PublishCtx(ctx context.Context, channel string, message any) *redis.IntCmd
- func (r *GoRedisEX) RPop(key string) *redis.StringCmd
- func (r *GoRedisEX) RPopCount(key string, count int) *redis.StringSliceCmd
- func (r *GoRedisEX) RPopCountCtx(ctx context.Context, key string, count int) *redis.StringSliceCmd
- func (r *GoRedisEX) RPopCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) RPopLPush(source, destination string) *redis.StringCmd
- func (r *GoRedisEX) RPopLPushCtx(ctx context.Context, source, destination string) *redis.StringCmd
- func (r *GoRedisEX) RPush(key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) RPushCtx(ctx context.Context, key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) RPushX(key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) RPushXCtx(ctx context.Context, key string, values ...any) *redis.IntCmd
- func (r *GoRedisEX) RandomKey() *redis.StringCmd
- func (r *GoRedisEX) RandomKeyCtx(ctx context.Context) *redis.StringCmd
- func (r *GoRedisEX) Rename(key, newkey string) *redis.StatusCmd
- func (r *GoRedisEX) RenameCtx(ctx context.Context, key, newkey string) *redis.StatusCmd
- func (r *GoRedisEX) RenameNX(key, newkey string) *redis.BoolCmd
- func (r *GoRedisEX) RenameNXCtx(ctx context.Context, key, newkey string) *redis.BoolCmd
- func (r *GoRedisEX) Restore(key string, ttl time.Duration, value string) *redis.StatusCmd
- func (r *GoRedisEX) RestoreCtx(ctx context.Context, key string, ttl time.Duration, value string) *redis.StatusCmd
- func (r *GoRedisEX) RestoreReplace(key string, ttl time.Duration, value string) *redis.StatusCmd
- func (r *GoRedisEX) RestoreReplaceCtx(ctx context.Context, key string, ttl time.Duration, value string) *redis.StatusCmd
- func (r *GoRedisEX) SAdd(key string, members ...interface{}) *redis.IntCmd
- func (r *GoRedisEX) SAddCtx(ctx context.Context, key string, members ...interface{}) *redis.IntCmd
- func (r *GoRedisEX) SCard(key string) *redis.IntCmd
- func (r *GoRedisEX) SCardCtx(ctx context.Context, key string) *redis.IntCmd
- func (r *GoRedisEX) SDiff(keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) SDiffCtx(ctx context.Context, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) SDiffStore(destination string, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) SDiffStoreCtx(ctx context.Context, destination string, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) SInter(keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) SInterCtx(ctx context.Context, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) SInterStore(destination string, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) SInterStoreCtx(ctx context.Context, destination string, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) SIsMember(key string, member interface{}) *redis.BoolCmd
- func (r *GoRedisEX) SIsMemberCtx(ctx context.Context, key string, member interface{}) *redis.BoolCmd
- func (r *GoRedisEX) SMIsMember(key string, members ...interface{}) *redis.BoolSliceCmd
- func (r *GoRedisEX) SMIsMemberCtx(ctx context.Context, key string, members ...interface{}) *redis.BoolSliceCmd
- func (r *GoRedisEX) SMembers(key string) *redis.StringSliceCmd
- func (r *GoRedisEX) SMembersCtx(ctx context.Context, key string) *redis.StringSliceCmd
- func (r *GoRedisEX) SMembersMap(key string) *redis.StringStructMapCmd
- func (r *GoRedisEX) SMembersMapCtx(ctx context.Context, key string) *redis.StringStructMapCmd
- func (r *GoRedisEX) SMove(source, destination string, member interface{}) *redis.BoolCmd
- func (r *GoRedisEX) SMoveCtx(ctx context.Context, source, destination string, member interface{}) *redis.BoolCmd
- func (r *GoRedisEX) SPop(key string) *redis.StringCmd
- func (r *GoRedisEX) SPopCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) SPopN(key string, count int64) *redis.StringSliceCmd
- func (r *GoRedisEX) SPopNCtx(ctx context.Context, key string, count int64) *redis.StringSliceCmd
- func (r *GoRedisEX) SRandMember(key string) *redis.StringCmd
- func (r *GoRedisEX) SRandMemberCtx(ctx context.Context, key string) *redis.StringCmd
- func (r *GoRedisEX) SRandMemberN(key string, count int64) *redis.StringSliceCmd
- func (r *GoRedisEX) SRandMemberNCtx(ctx context.Context, key string, count int64) *redis.StringSliceCmd
- func (r *GoRedisEX) SRem(key string, members ...interface{}) *redis.IntCmd
- func (r *GoRedisEX) SRemCtx(ctx context.Context, key string, members ...interface{}) *redis.IntCmd
- func (r *GoRedisEX) SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *GoRedisEX) SScanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *GoRedisEX) SUnion(keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) SUnionCtx(ctx context.Context, keys ...string) *redis.StringSliceCmd
- func (r *GoRedisEX) Scan(cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *GoRedisEX) ScanCtx(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *GoRedisEX) ScanType(cursor uint64, match string, count int64, keyType string) *redis.ScanCmd
- func (r *GoRedisEX) ScanTypeCtx(ctx context.Context, cursor uint64, match string, count int64, keyType string) *redis.ScanCmd
- func (r *GoRedisEX) Set(key string, value string) *redis.StatusCmd
- func (r *GoRedisEX) SetCtx(ctx context.Context, key string, value string) *redis.StatusCmd
- func (r *GoRedisEX) SetEX(key string, value string, expiration time.Duration) *redis.StatusCmd
- func (r *GoRedisEX) SetExCtx(ctx context.Context, key string, value string, expiration time.Duration) *redis.StatusCmd
- func (r *GoRedisEX) SetNX(key string, value string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) SetNXCtx(ctx context.Context, key string, value string, expiration time.Duration) *redis.BoolCmd
- func (r *GoRedisEX) SetScan(key string, v any) *zservice.Error
- func (r *GoRedisEX) SetScanEX(key string, v any, expiration time.Duration) *zservice.Error
- func (r *GoRedisEX) Sort(ctx context.Context, key string, sort *redis.Sort) *redis.StringSliceCmd
- func (r *GoRedisEX) SortCtx(ctx context.Context, key string, sort *redis.Sort) *redis.StringSliceCmd
- func (r *GoRedisEX) SortInterfaces(ctx context.Context, key string, sort *redis.Sort) *redis.SliceCmd
- func (r *GoRedisEX) SortInterfacesCtx(ctx context.Context, key string, sort *redis.Sort) *redis.SliceCmd
- func (r *GoRedisEX) SortRO(ctx context.Context, key string, sort *redis.Sort) *redis.StringSliceCmd
- func (r *GoRedisEX) SortROCtx(ctx context.Context, key string, sort *redis.Sort) *redis.StringSliceCmd
- func (r *GoRedisEX) SortStore(ctx context.Context, key, store string, sort *redis.Sort) *redis.IntCmd
- func (r *GoRedisEX) SortStoreCtx(ctx context.Context, key, store string, sort *redis.Sort) *redis.IntCmd
- func (r *GoRedisEX) Sub(channel string, cb func(*zservice.Context, string, []byte)) *redis.PubSub
- func (r *GoRedisEX) SubCtx(ctx *zservice.Context, channel string, ...) *redis.PubSub
- func (r *GoRedisEX) TTL(key string) *redis.DurationCmd
- func (r *GoRedisEX) TTLCtx(ctx context.Context, key string) *redis.DurationCmd
- func (r *GoRedisEX) Touch(keys ...string) *redis.IntCmd
- func (r *GoRedisEX) TouchCtx(ctx context.Context, keys ...string) *redis.IntCmd
- func (r *GoRedisEX) Type(key string) *redis.StatusCmd
- func (r *GoRedisEX) TypeCtx(ctx context.Context, key string) *redis.StatusCmd
- type GormEX
- type HasTableValueOption
- type LockOrWaitOption
- type PubsubBody
- type SaveTableValueOption
Constants ¶
This section is empty.
Variables ¶
View Source
var LockOrWaitOptionDefault = LockOrWaitOption{}
默认锁配置
Functions ¶
This section is empty.
Types ¶
type DBService ¶
type DBService struct { *zservice.ZService Gorm *GormEX // 数据库 gorm Redis *GoRedisEX // 缓存 redis // contains filtered or unexported fields }
数据服务,结合:github.com/redis/go-redis/v9 和 gorm.io/gorm 配合使用
func NewDBService ¶
func NewDBService(opt DBServiceOption) *DBService
func (*DBService) GetNewTableID ¶
func (dbs *DBService) GetNewTableID( ctx *zservice.Context, genID func() uint32, verifyFN func(ctx *zservice.Context, id uint32) (bool, *zservice.Error), ) (uint32, *zservice.Error)
获取一个新的ID
func (*DBService) GetTableValue ¶
获取指定值 注意,如果没找到数据回返回:zservice.Code_NotFound
func (*DBService) HasTableValue ¶
func (dbs *DBService) HasTableValue(ctx *zservice.Context, opt HasTableValueOption) (bool, *zservice.Error)
查询表中是否有指定值
func (*DBService) SaveTableValue ¶
func (dbs *DBService) SaveTableValue(ctx *zservice.Context, opt SaveTableValueOption) *zservice.Error
存储表数据
type DBServiceOption ¶
type DBServiceOption struct { Name string // 服务名称 仅用于日志显示,如果主服务中有多个DBService,建议配置,如果只有一个DBService,可以忽略此配置 DBType string // 数据库 类型 目前支持 mysql/postgres DBName string // 数据库 名称 DBHost string // 数据库 地址 填入地址才会启用 Gorm 功能 DBPort int // 数据库 端口 DBUser string // 数据库 用户名 DBPass string // 数据库 密码 DBParams string // 数据库 额外参数 MaxIdleConns int // 最大空闲连接数 default: 10 MaxOpenConns int // 最大连接数 default: 30 ConnMaxLifetime float32 // 连接最大生命周期 default: 300s RedisAddr string // redis 地址 填入地址才会启用 Redis 功能 RedisPass string // redis 密码 RedisPrefix string // redis 前缀 默认使用 zservice.Init 中的 serviceName Debug bool // 是否开启 debug OnStart func(*DBService) // 启动的回调 }
type GetTableValueOption ¶
type GetTableValueOption struct { Tab any // 需要查询的表结构体对象 RK string // redis缓存Key SQLConds []any // 查询条件, 使用 Gorm 中的 Where 条件,不要自己拼接,避免 sql 注入 Order string // 排序 Expires *time.Duration // 缓存过期时间,默认:10天, 0 表示不过期 RedisGetFN func(*zservice.Context, any, string) (bool, *zservice.Error) // 获取缓存数据,需要对数据进行重新处理, 返回处理状态或者错误消息,处理后的数据为空表示处理失败,会继续进行数据查询 RedisSetFN func(*zservice.Context, any) string // 存储缓存数据,返回处理后的字符串,字符串将存储到 redis }
type GoRedisEX ¶
type GoRedisEX struct {
// contains filtered or unexported fields
}
func NewGoRedisEX ¶
func NewGoRedisEX(opt DBServiceOption) *GoRedisEX
func (*GoRedisEX) AddkeyPrefixs ¶
func (*GoRedisEX) BRPopLPush ¶
func (*GoRedisEX) BRPopLPushCtx ¶
func (*GoRedisEX) ExpireAtCtx ¶
func (*GoRedisEX) ExpireGTCtx ¶
func (*GoRedisEX) ExpireLTCtx ¶
func (*GoRedisEX) ExpireNXCtx ¶
func (*GoRedisEX) ExpireTime ¶
func (*GoRedisEX) ExpireTimeCtx ¶
func (*GoRedisEX) ExpireXXCtx ¶
func (*GoRedisEX) HExistsCtx ¶
func (*GoRedisEX) HGetAllCtx ¶
func (*GoRedisEX) HIncrByCtx ¶
func (*GoRedisEX) HIncrByFloat ¶
func (*GoRedisEX) HIncrByFloatCtx ¶
func (*GoRedisEX) HRandField ¶
func (*GoRedisEX) HRandFieldCtx ¶
func (*GoRedisEX) HRandFieldWithValues ¶
func (*GoRedisEX) HRandFieldWithValuesCtx ¶
func (*GoRedisEX) LInsertAfter ¶
func (*GoRedisEX) LInsertAfterCtx ¶
func (*GoRedisEX) LInsertBefore ¶
func (*GoRedisEX) LInsertBeforeCtx ¶
func (*GoRedisEX) LInsertCtx ¶
func (*GoRedisEX) LPopCountCtx ¶
func (*GoRedisEX) LPosCountCtx ¶
func (*GoRedisEX) LockOrWait ¶ added in v0.1.8
func (r *GoRedisEX) LockOrWait(key string, opt LockOrWaitOption) (func(), *zservice.Error)
加锁,等待直到超时, timeout[0]等待时间 timeout[1]超时时间
func (*GoRedisEX) LockOrWaitCtx ¶ added in v0.1.8
func (*GoRedisEX) MigrateCtx ¶
func (*GoRedisEX) ObjectEncoding ¶
func (*GoRedisEX) ObjectEncodingCtx ¶
func (*GoRedisEX) ObjectFreq ¶
func (*GoRedisEX) ObjectFreqCtx ¶
func (*GoRedisEX) ObjectIdleTime ¶
func (*GoRedisEX) ObjectIdleTimeCtx ¶
func (*GoRedisEX) ObjectRefCount ¶
func (*GoRedisEX) ObjectRefCountCtx ¶
func (*GoRedisEX) PExpireAtCtx ¶
func (*GoRedisEX) PExpireCtx ¶
func (*GoRedisEX) PExpireTime ¶
func (*GoRedisEX) PExpireTimeCtx ¶
func (*GoRedisEX) PersistCtx ¶
func (*GoRedisEX) PublishCtx ¶ added in v0.1.13
func (*GoRedisEX) RPopCountCtx ¶
func (*GoRedisEX) RPopLPushCtx ¶
func (*GoRedisEX) RandomKeyCtx ¶
func (*GoRedisEX) RenameNXCtx ¶
func (*GoRedisEX) RestoreCtx ¶
func (*GoRedisEX) RestoreReplace ¶
func (*GoRedisEX) RestoreReplaceCtx ¶
func (*GoRedisEX) SDiffStore ¶ added in v0.1.8
func (*GoRedisEX) SDiffStoreCtx ¶ added in v0.1.8
func (*GoRedisEX) SInterStore ¶ added in v0.1.8
func (*GoRedisEX) SInterStoreCtx ¶ added in v0.1.8
func (*GoRedisEX) SIsMemberCtx ¶ added in v0.1.8
func (*GoRedisEX) SMIsMember ¶ added in v0.1.8
func (*GoRedisEX) SMIsMemberCtx ¶ added in v0.1.8
func (*GoRedisEX) SMembersCtx ¶ added in v0.1.8
func (*GoRedisEX) SMembersMap ¶ added in v0.1.8
func (*GoRedisEX) SMembersMapCtx ¶ added in v0.1.8
func (*GoRedisEX) SRandMember ¶ added in v0.1.8
func (*GoRedisEX) SRandMemberCtx ¶ added in v0.1.8
func (*GoRedisEX) SRandMemberN ¶ added in v0.1.8
func (*GoRedisEX) SRandMemberNCtx ¶ added in v0.1.8
func (*GoRedisEX) ScanType ¶
func (r *GoRedisEX) ScanType(cursor uint64, match string, count int64, keyType string) *redis.ScanCmd
注意,返回数据包含 key 前缀
func (*GoRedisEX) ScanTypeCtx ¶
func (*GoRedisEX) SortInterfaces ¶
func (*GoRedisEX) SortInterfacesCtx ¶
func (*GoRedisEX) SortStoreCtx ¶
type GormEX ¶
func NewGormEX ¶
func NewGormEX(opt DBServiceOption) *GormEX
func (*GormEX) IsNotFoundErr ¶
type HasTableValueOption ¶
type LockOrWaitOption ¶ added in v0.1.8
type PubsubBody ¶ added in v0.1.13
redis 消息订阅发布参数
type SaveTableValueOption ¶ added in v0.1.2
Click to show internal directories.
Click to hide internal directories.