Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigureDBCache(db *gorm.DB, cacheManager gocache.CacheInterface[any])
- func ConfigureMetrics(db *gorm.DB, dbName string, refreshInterval uint32, labels map[string]string, ...)
- func NewDb(conf config.Config) (db *gorm.DB)
- type CacherAdapter
- type Marshaler
- func (c *Marshaler) Clear(ctx context.Context) error
- func (c *Marshaler) Delete(ctx context.Context, key any) error
- func (c *Marshaler) Get(ctx context.Context, key any, returnObj any) (any, error)
- func (c *Marshaler) Invalidate(ctx context.Context, options ...store.InvalidateOption) error
- func (c *Marshaler) Set(ctx context.Context, key, object any, options ...store.Option) error
Constants ¶
View Source
const ( DriverMysql = "mysql" DriverPostgres = "postgres" DriverSqlite = "sqlite" DriverSqlserver = "sqlserver" DriverTidb = "tidb" DriverClickhouse = "clickhouse" )
Variables ¶
View Source
var Db *gorm.DB
Functions ¶
func ConfigureDBCache ¶ added in v2.2.0
func ConfigureDBCache(db *gorm.DB, cacheManager gocache.CacheInterface[any])
func ConfigureMetrics ¶ added in v2.2.0
func ConfigureMetrics(db *gorm.DB, dbName string, refreshInterval uint32, labels map[string]string, collectors ...prometheus.MetricsCollector)
Types ¶
type CacherAdapter ¶ added in v2.2.0
type CacherAdapter struct {
// contains filtered or unexported fields
}
func NewCacherAdapter ¶ added in v2.2.0
func NewCacherAdapter(cacheManager cache.CacheInterface[any]) *CacherAdapter
type Marshaler ¶ added in v2.2.0
type Marshaler struct {
// contains filtered or unexported fields
}
Marshaler is the struct that marshal and unmarshal cache values
func NewMarshaler ¶ added in v2.2.0
func NewMarshaler(cache cache.CacheInterface[any]) *Marshaler
NewMarshaler creates a new marshaler that marshals/unmarshals cache values
func (*Marshaler) Get ¶ added in v2.2.0
Get obtains a value from cache and unmarshal value with given object
func (*Marshaler) Invalidate ¶ added in v2.2.0
Invalidate invalidate cache values using given options
Click to show internal directories.
Click to hide internal directories.