Documentation
¶
Index ¶
- Variables
- type Cache
- type CacheClearFunc
- type CacheGetSetFunc
- type LocalCache
- type MultiCache
- func (c *MultiCache) Append(cache Cache) *MultiCache
- func (c *MultiCache) DelCache(key string) error
- func (c *MultiCache) DelCacheFromLevel(key string, levelIdx int) error
- func (c *MultiCache) GetCache(key string, data interface{}) error
- func (c *MultiCache) HasCache(key string) bool
- func (c *MultiCache) SetCache(key string, data interface{}) error
- type RedigoCache
- func (c *RedigoCache) DelCache(key string) error
- func (c *RedigoCache) GetCache(key string, data interface{}) error
- func (c *RedigoCache) HasCache(key string) bool
- func (c *RedigoCache) NilFlag(nilFlag string) *RedigoCache
- func (c *RedigoCache) NilTime(nilTime time.Duration) *RedigoCache
- func (c *RedigoCache) Serial(serial gfserial.Serializer) *RedigoCache
- func (c *RedigoCache) SetCache(key string, data interface{}) error
- func (c *RedigoCache) Timeout(timeout time.Duration) *RedigoCache
- type RedisCache
- func (c *RedisCache) DelCache(key string) error
- func (c *RedisCache) GetCache(key string, data interface{}) error
- func (c *RedisCache) HasCache(key string) bool
- func (c *RedisCache) NilFlag(nilFlag string) *RedisCache
- func (c *RedisCache) NilTime(nilTime time.Duration) *RedisCache
- func (c *RedisCache) Serial(serial gfserial.Serializer) *RedisCache
- func (c *RedisCache) SetCache(key string, data interface{}) error
- func (c *RedisCache) Timeout(timeout time.Duration) *RedisCache
- type SourceDB
- type SourceDBTx
- type SqlCache
- func (c *SqlCache) Execute(ctx context.Context, clearKeys []string, query string, args ...interface{}) (sql.Result, error)
- func (c *SqlCache) ExecuteWithFunc(ctx context.Context, clearFn CacheClearFunc, query string, args ...interface{}) (sql.Result, error)
- func (c *SqlCache) Query(ctx context.Context, cacheKey string, dest interface{}, query string, ...) error
- func (c *SqlCache) QueryWithFunc(ctx context.Context, getFn, setFn CacheGetSetFunc, dest interface{}, ...) error
- type SqlCacheTx
- type SqlxDB
- func (d *SqlxDB) Execute(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (d *SqlxDB) Query(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (d *SqlxDB) SourceDB() SourceDB
- func (d *SqlxDB) Transact(ctx context.Context, txFn TransactFunc[*sqlx.Tx]) (retErr error)
- type TransactFunc
- type Transaction
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RecordNotFound = errors.New("record not found") CacheNotFound = errors.New("cache not found") )
Functions ¶
This section is empty.
Types ¶
type CacheClearFunc ¶
type CacheGetSetFunc ¶
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
func NewLocalCache ¶
func NewLocalCache(timeout time.Duration) *LocalCache
func (*LocalCache) DelCache ¶
func (c *LocalCache) DelCache(key string) error
func (*LocalCache) GetCache ¶
func (c *LocalCache) GetCache(key string, data interface{}) error
func (*LocalCache) HasCache ¶
func (c *LocalCache) HasCache(key string) bool
func (*LocalCache) Serial ¶
func (c *LocalCache) Serial(serial gfserial.Serializer) *LocalCache
func (*LocalCache) SetCache ¶
func (c *LocalCache) SetCache(key string, data interface{}) error
type MultiCache ¶
type MultiCache struct {
// contains filtered or unexported fields
}
func NewMultiCache ¶
func NewMultiCache(caches ...Cache) *MultiCache
func (*MultiCache) Append ¶
func (c *MultiCache) Append(cache Cache) *MultiCache
func (*MultiCache) DelCache ¶
func (c *MultiCache) DelCache(key string) error
func (*MultiCache) DelCacheFromLevel ¶
func (c *MultiCache) DelCacheFromLevel(key string, levelIdx int) error
func (*MultiCache) GetCache ¶
func (c *MultiCache) GetCache(key string, data interface{}) error
func (*MultiCache) HasCache ¶
func (c *MultiCache) HasCache(key string) bool
func (*MultiCache) SetCache ¶
func (c *MultiCache) SetCache(key string, data interface{}) error
type RedigoCache ¶
type RedigoCache struct {
// contains filtered or unexported fields
}
func NewRedigoCache ¶
func NewRedigoCache(redis *redis.Pool) *RedigoCache
func (*RedigoCache) DelCache ¶
func (c *RedigoCache) DelCache(key string) error
func (*RedigoCache) GetCache ¶
func (c *RedigoCache) GetCache(key string, data interface{}) error
func (*RedigoCache) HasCache ¶
func (c *RedigoCache) HasCache(key string) bool
func (*RedigoCache) NilFlag ¶
func (c *RedigoCache) NilFlag(nilFlag string) *RedigoCache
func (*RedigoCache) NilTime ¶
func (c *RedigoCache) NilTime(nilTime time.Duration) *RedigoCache
func (*RedigoCache) Serial ¶
func (c *RedigoCache) Serial(serial gfserial.Serializer) *RedigoCache
func (*RedigoCache) SetCache ¶
func (c *RedigoCache) SetCache(key string, data interface{}) error
func (*RedigoCache) Timeout ¶
func (c *RedigoCache) Timeout(timeout time.Duration) *RedigoCache
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(redis *redis.Client) *RedisCache
func (*RedisCache) DelCache ¶
func (c *RedisCache) DelCache(key string) error
func (*RedisCache) GetCache ¶
func (c *RedisCache) GetCache(key string, data interface{}) error
func (*RedisCache) HasCache ¶
func (c *RedisCache) HasCache(key string) bool
func (*RedisCache) NilFlag ¶
func (c *RedisCache) NilFlag(nilFlag string) *RedisCache
func (*RedisCache) NilTime ¶
func (c *RedisCache) NilTime(nilTime time.Duration) *RedisCache
func (*RedisCache) Serial ¶
func (c *RedisCache) Serial(serial gfserial.Serializer) *RedisCache
func (*RedisCache) SetCache ¶
func (c *RedisCache) SetCache(key string, data interface{}) error
func (*RedisCache) Timeout ¶
func (c *RedisCache) Timeout(timeout time.Duration) *RedisCache
type SourceDBTx ¶
type SourceDBTx[T Transaction] interface { Transact(ctx context.Context, txFn TransactFunc[T]) error SourceDB() SourceDB }
type SqlCache ¶
type SqlCache struct {
// contains filtered or unexported fields
}
func NewSqlCache ¶
func (*SqlCache) ExecuteWithFunc ¶
func (*SqlCache) QueryWithFunc ¶
type SqlCacheTx ¶
type SqlCacheTx[T Transaction] struct { SqlCache // contains filtered or unexported fields }
func NewSqlCacheTx ¶
func NewSqlCacheTx[T Transaction](db SourceDBTx[T], cache Cache) *SqlCacheTx[T]
func (*SqlCacheTx[T]) Transact ¶
func (c *SqlCacheTx[T]) Transact(ctx context.Context, clearFn CacheClearFunc, txFn TransactFunc[T]) error
type SqlxDB ¶
type SqlxDB struct {
// contains filtered or unexported fields
}
type TransactFunc ¶
type TransactFunc[T Transaction] func(tx T) error
type Transaction ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.