Documentation
¶
Index ¶
- func GetConnectionByParams(Ctx context.Context, connCache *SafeDbMapCache, duration time.Duration, ...) (*sqlx.DB, error)
- func GetConnectionWithMapper(Ctx context.Context, connCache *SafeDbMapCache, duration time.Duration, ...) (*sqlx.DB, error)
- func JsonMapperFunc() *reflectx.Mapper
- type PoolItem
- type SafeDbMapCache
- func (c *SafeDbMapCache) ClearAll()
- func (c *SafeDbMapCache) Delete(key string) error
- func (c *SafeDbMapCache) ExpiredKeys() (keys []string)
- func (c *SafeDbMapCache) GC()
- func (c *SafeDbMapCache) Get(key string) (*sqlx.DB, bool)
- func (c *SafeDbMapCache) GetItems() (items []string)
- func (c *SafeDbMapCache) Set(key string, value *sqlx.DB, duration time.Duration)
- func (c *SafeDbMapCache) StartGC()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConnectionByParams ¶
func GetConnectionByParams(Ctx context.Context, connCache *SafeDbMapCache, duration time.Duration, driver, connString string) (*sqlx.DB, error)
GetConnectionByParams - get *sqlx.DB from cache (if exists, with default-json-mapperFunc) or create new and put into cache
func GetConnectionWithMapper ¶ added in v1.1.0
func GetConnectionWithMapper( Ctx context.Context, connCache *SafeDbMapCache, duration time.Duration, driver, connString string, mapperFunc *reflectx.Mapper) (*sqlx.DB, error)
GetConnectionWithMapper - get *sqlx.DB from cache (if exists, with set mapperFunc) or create new and put into cache
func JsonMapperFunc ¶ added in v1.1.0
Types ¶
type SafeDbMapCache ¶
func New ¶
func New(defaultExpiration, cleanupInterval time.Duration) *SafeDbMapCache
New - initializing a new SafeDbMapCache cache
func (*SafeDbMapCache) Delete ¶
func (c *SafeDbMapCache) Delete(key string) error
Delete - delete *sqlx.DB value by key. Return false if key not found
func (*SafeDbMapCache) ExpiredKeys ¶
func (c *SafeDbMapCache) ExpiredKeys() (keys []string)
ExpiredKeys - returns list of expired keys.
func (*SafeDbMapCache) Get ¶
func (c *SafeDbMapCache) Get(key string) (*sqlx.DB, bool)
Get - getting *sqlx.DB value by key
func (*SafeDbMapCache) GetItems ¶
func (c *SafeDbMapCache) GetItems() (items []string)
GetItems - returns item list.
func (*SafeDbMapCache) StartGC ¶
func (c *SafeDbMapCache) StartGC()
StartGC - start Garbage Collection
Click to show internal directories.
Click to hide internal directories.