cbdb

package module
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachableResultModel added in v0.2.0

type CachableResultModel interface {
	GetCacheKey() string
	GetCacheBucket() string
}

type Cache added in v0.2.0

type Cache struct {
	// contains filtered or unexported fields
}

func (*Cache) Cache added in v0.2.0

func (c *Cache) Cache(args CacheArgs) error

func (*Cache) CountWhere added in v0.2.0

func (c *Cache) CountWhere(where CachableResultModel, ttl time.Duration) (int64, error)

func (*Cache) DeleteWhereFlush added in v0.2.3

func (c *Cache) DeleteWhereFlush(model CachableResultModel, where CachableResultModel) error

func (*Cache) FindWhere added in v0.2.0

func (c *Cache) FindWhere(out interface{}, where CachableResultModel, ttl time.Duration) error

func (*Cache) FirstWhere added in v0.2.0

func (c *Cache) FirstWhere(out interface{}, where CachableResultModel, ttl time.Duration) error

func (*Cache) Flush added in v0.2.0

func (c *Cache) Flush(keyGen CacheKeyGenerator) error

func (*Cache) LastWhere added in v0.2.0

func (c *Cache) LastWhere(out interface{}, where CachableResultModel, ttl time.Duration) error

func (*Cache) SaveFlush added in v0.2.0

func (c *Cache) SaveFlush(model CachableResultModel) error

type CacheArgs added in v0.2.0

type CacheArgs struct {
	Miss   func(db *GormReadWrite, out interface{}) error
	Out    interface{}
	Ttl    time.Duration
	KeyGen CacheKeyGenerator
}

type CacheKeyGenerator added in v0.2.0

type CacheKeyGenerator struct {
	Bucket   string
	Type     interface{}
	Search   CachableResultModel
	Preloads []string
	Wheres   []string
	Order    string
	Limit    int
	Offset   int
	Group    string
	Extra    []string
}

func (*CacheKeyGenerator) Generate added in v0.2.0

func (k *CacheKeyGenerator) Generate() string

type CacheProvider added in v0.2.0

type CacheProvider interface {
	Get(key string) (interface{}, bool)
	Delete(key string)
	Set(key string, value interface{}, ttl time.Duration)
}

type Config

type Config interface {
	Get(path string) interface{}
	GetInt(path string) int
	GetString(path string) string
}

type ErrorHandler

type ErrorHandler interface {
	Error(e error)
}

type GormReadWrite

type GormReadWrite struct {
	// contains filtered or unexported fields
}

func (*GormReadWrite) Close added in v0.0.2

func (g *GormReadWrite) Close() error

func (*GormReadWrite) GetCache added in v0.2.0

func (g *GormReadWrite) GetCache() *Cache

func (*GormReadWrite) InitCache added in v0.2.0

func (g *GormReadWrite) InitCache(constructor func() CacheProvider)

func (*GormReadWrite) Read

func (g *GormReadWrite) Read() *gorm.DB

func (*GormReadWrite) ReadMock added in v0.1.0

func (g *GormReadWrite) ReadMock() sqlmock.Sqlmock

func (*GormReadWrite) SetRead added in v0.0.2

func (g *GormReadWrite) SetRead(db *gorm.DB)

func (*GormReadWrite) SetReadMock added in v0.1.0

func (g *GormReadWrite) SetReadMock(db sqlmock.Sqlmock)

func (*GormReadWrite) SetWrite added in v0.0.2

func (g *GormReadWrite) SetWrite(db *gorm.DB)

func (*GormReadWrite) SetWriteMock added in v0.1.0

func (g *GormReadWrite) SetWriteMock(db sqlmock.Sqlmock)

func (*GormReadWrite) Write

func (g *GormReadWrite) Write() *gorm.DB

func (*GormReadWrite) WriteMock added in v0.1.0

func (g *GormReadWrite) WriteMock() sqlmock.Sqlmock

type Logger

type Logger interface {
	ErrorF(category string, message string, args ...interface{})
	Print(v ...interface{})
}

type PathInterfaceGetter

type PathInterfaceGetter interface {
	Get(path string) interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL