Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
ID string `db:"id"`
Key string `db:"cache_key"`
Value string `db:"cache_value"`
ExpiresAt *time.Time `db:"expires_at"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
DeletedAt *time.Time `db:"deleted_at"`
}
Cache type
type NewStoreOptions ¶
type NewStoreOptions struct {
CacheTableName string
DB *sql.DB
DbDriverName string
TimeoutSeconds int64
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new session store
type StoreInterface ¶
type StoreInterface interface {
AutoMigrate() error
EnableDebug(debugEnabled bool)
DriverName(db *sql.DB) string
ExpireCacheGoroutine(ctx context.Context) error
Set(key string, value string, seconds int64) error
Get(key string, valueDefault string) (string, error)
SetJSON(key string, value any, seconds int64) error
GetJSON(key string, valueDefault any) (any, error)
Remove(key string) error
FindByKey(key string) (*Cache, error)
}
func NewStore ¶
func NewStore(opts NewStoreOptions) (StoreInterface, error)
NewStore creates a new entity store
Click to show internal directories.
Click to hide internal directories.