Documentation ¶
Index ¶
- Variables
- type Cassandra
- type CassandraOp
- type ConnParams
- type KKDatabase
- type KKDatabaseLogger
- type KKDatabaseLoggerUnit
- type KKDatabaseOp
- type KKRedis
- type KKRedisOp
- func (k *KKRedisOp) ActiveCount() int
- func (k *KKRedisOp) Close() error
- func (k *KKRedisOp) Conn() redis.Conn
- func (k *KKRedisOp) Delete(key ...interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) Exists(key ...interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) Expire(key interface{}, ttl int64) *KKRedisOpResponse
- func (k *KKRedisOp) Get(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HDel(key interface{}, field ...interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HExists(key, field interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HGet(key, field interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HGetAll(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HIncrBy(key interface{}, field interface{}, val int64) *KKRedisOpResponse
- func (k *KKRedisOp) HKeys(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HLen(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HMGet(key interface{}, field ...interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HMSet(key interface{}, val map[interface{}]interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HSet(key, field, val interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) HVals(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) IdleCount() int
- func (k *KKRedisOp) Incr(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) IncrBy(key interface{}, val int64) *KKRedisOpResponse
- func (k *KKRedisOp) Keys(key interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) Publish(key interface{}, val interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) Set(key interface{}, val interface{}) *KKRedisOpResponse
- func (k *KKRedisOp) SetExpire(key interface{}, val interface{}, ttl int64) *KKRedisOpResponse
- type KKRedisOpResponse
- type KKRedisOpResponseUnit
- type OPType
- type RedisOpType
Constants ¶
This section is empty.
Variables ¶
View Source
var KKCassandraDebug = false
View Source
var KKCassandraLocker = sync.Mutex{}
View Source
var KKCassandraProfiles = sync.Map{}
View Source
var KKDBParamCharset = ""
Params ref: https://gorm.io/docs/connecting_to_the_database.html
View Source
var KKDBParamClientFoundRows = false
View Source
var KKDBParamCollation = "utf8mb4_general_ci"
View Source
var KKDBParamConnMaxIdleTime = 0
View Source
var KKDBParamConnMaxLifetime = 20000
View Source
var KKDBParamDialTimeout = "3s"
View Source
var KKDBParamLoc = "Local"
View Source
var KKDBParamMaxAllowedPacket = 25165824
View Source
var KKDBParamParseTime = true
View Source
var KKDBParamReadTimeout = "30s"
View Source
var KKDBParamReaderMaxIdleConn = 32
View Source
var KKDBParamReaderMaxOpenConn = 64
View Source
var KKDBParamWriteTimeout = "30s"
View Source
var KKDBParamWriterMaxIdleConn = 32
View Source
var KKDBParamWriterMaxOpenConn = 64
View Source
var KKDatabaseDebug = false
View Source
var KKDatabaseLocker = sync.Mutex{}
View Source
var KKDatabaseProfiles = sync.Map{}
View Source
var KKRedisDebug = false
View Source
var KKRedisDialTimeout = 1000
View Source
var KKRedisIdleTimeout = 60000
View Source
var KKRedisLocker = sync.Mutex{}
View Source
var KKRedisMaxActive = 0
View Source
var KKRedisMaxConnLifetime = 0
View Source
var KKRedisMaxIdle = 20
View Source
var KKRedisProfiles = sync.Map{}
View Source
var KKRedisWait = false
View Source
var RedisNotFound = fmt.Errorf("not_found")
Functions ¶
This section is empty.
Types ¶
type Cassandra ¶
type Cassandra struct {
// contains filtered or unexported fields
}
func KKCassandra ¶
func (*Cassandra) Reader ¶
func (k *Cassandra) Reader() *CassandraOp
func (*Cassandra) Writer ¶
func (k *Cassandra) Writer() *CassandraOp
type CassandraOp ¶
type CassandraOp struct {
// contains filtered or unexported fields
}
func (*CassandraOp) Cluster ¶
func (k *CassandraOp) Cluster() *gocql.ClusterConfig
func (*CassandraOp) Session ¶
func (k *CassandraOp) Session() *gocql.Session
type ConnParams ¶
type ConnParams struct { KKDBParamCharset string KKDBParamTimeout string KKDBParamReadTimeout string KKDBParamWriteTimeout string KKDBParamCollation string KKDBParamLoc string KKDBParamClientFoundRows bool KKDBParamParseTime bool KKDBParamMaxAllowedPacket int KKDBParamMaxOpenConn int KKDBParamMaxIdleConn int KKDBParamConnMaxLifetime int KKDBParamConnMaxIdleTime int }
type KKDatabase ¶
type KKDatabase struct {
// contains filtered or unexported fields
}
can be improvement by add more connection
func KKDB ¶
func KKDB(dbname string) *KKDatabase
func (*KKDatabase) Reader ¶
func (k *KKDatabase) Reader() *KKDatabaseOp
func (*KKDatabase) Writer ¶
func (k *KKDatabase) Writer() *KKDatabaseOp
type KKDatabaseLogger ¶
type KKDatabaseLogger struct { }
func (*KKDatabaseLogger) Print ¶
func (k *KKDatabaseLogger) Print(v ...interface{})
type KKDatabaseLoggerUnit ¶
type KKDatabaseLoggerUnit struct {
Logs []string `json:"logs"`
}
type KKDatabaseOp ¶
type KKDatabaseOp struct { ConnParams ConnParams // contains filtered or unexported fields }
func (*KKDatabaseOp) Adapter ¶
func (ke *KKDatabaseOp) Adapter() string
func (*KKDatabaseOp) Close ¶
func (ke *KKDatabaseOp) Close() error
func (*KKDatabaseOp) DB ¶
func (ke *KKDatabaseOp) DB() *gorm.DB
type KKRedis ¶
type KKRedis struct {
// contains filtered or unexported fields
}
can be improvement by add more connection
type KKRedisOp ¶
type KKRedisOp struct {
// contains filtered or unexported fields
}
func (*KKRedisOp) ActiveCount ¶
func (*KKRedisOp) Delete ¶
func (k *KKRedisOp) Delete(key ...interface{}) *KKRedisOpResponse
func (*KKRedisOp) Exists ¶
func (k *KKRedisOp) Exists(key ...interface{}) *KKRedisOpResponse
func (*KKRedisOp) Expire ¶
func (k *KKRedisOp) Expire(key interface{}, ttl int64) *KKRedisOpResponse
func (*KKRedisOp) Get ¶
func (k *KKRedisOp) Get(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) HDel ¶
func (k *KKRedisOp) HDel(key interface{}, field ...interface{}) *KKRedisOpResponse
func (*KKRedisOp) HExists ¶
func (k *KKRedisOp) HExists(key, field interface{}) *KKRedisOpResponse
func (*KKRedisOp) HGet ¶
func (k *KKRedisOp) HGet(key, field interface{}) *KKRedisOpResponse
func (*KKRedisOp) HGetAll ¶
func (k *KKRedisOp) HGetAll(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) HIncrBy ¶
func (k *KKRedisOp) HIncrBy(key interface{}, field interface{}, val int64) *KKRedisOpResponse
func (*KKRedisOp) HKeys ¶
func (k *KKRedisOp) HKeys(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) HLen ¶
func (k *KKRedisOp) HLen(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) HMGet ¶
func (k *KKRedisOp) HMGet(key interface{}, field ...interface{}) *KKRedisOpResponse
func (*KKRedisOp) HMSet ¶
func (k *KKRedisOp) HMSet(key interface{}, val map[interface{}]interface{}) *KKRedisOpResponse
func (*KKRedisOp) HSet ¶
func (k *KKRedisOp) HSet(key, field, val interface{}) *KKRedisOpResponse
func (*KKRedisOp) HVals ¶
func (k *KKRedisOp) HVals(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) Incr ¶
func (k *KKRedisOp) Incr(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) IncrBy ¶
func (k *KKRedisOp) IncrBy(key interface{}, val int64) *KKRedisOpResponse
func (*KKRedisOp) Keys ¶
func (k *KKRedisOp) Keys(key interface{}) *KKRedisOpResponse
func (*KKRedisOp) Publish ¶
func (k *KKRedisOp) Publish(key interface{}, val interface{}) *KKRedisOpResponse
func (*KKRedisOp) Set ¶
func (k *KKRedisOp) Set(key interface{}, val interface{}) *KKRedisOpResponse
func (*KKRedisOp) SetExpire ¶
func (k *KKRedisOp) SetExpire(key interface{}, val interface{}, ttl int64) *KKRedisOpResponse
type KKRedisOpResponse ¶
type KKRedisOpResponse struct { KKRedisOpResponseUnit Error error }
func (*KKRedisOpResponse) GetSlice ¶
func (k *KKRedisOpResponse) GetSlice() []KKRedisOpResponseUnit
func (*KKRedisOpResponse) RecordNotFound ¶
func (k *KKRedisOpResponse) RecordNotFound() bool
type KKRedisOpResponseUnit ¶
type KKRedisOpResponseUnit struct {
// contains filtered or unexported fields
}
func (*KKRedisOpResponseUnit) GetBytes ¶
func (k *KKRedisOpResponseUnit) GetBytes() []byte
func (*KKRedisOpResponseUnit) GetInt64 ¶
func (k *KKRedisOpResponseUnit) GetInt64() int64
func (*KKRedisOpResponseUnit) GetString ¶
func (k *KKRedisOpResponseUnit) GetString() string
type RedisOpType ¶
type RedisOpType int
const ( TypeMaster RedisOpType = 0 TypeSlave RedisOpType = 1 )
Click to show internal directories.
Click to hide internal directories.