Documentation
¶
Overview ¶
The very core database/cache data operations package.
Index ¶
- Variables
- func DeleteOne(cache *core.Cache, key string) bool
- func DumpAll() string
- func GetAll[T any](cache *core.Cache, model T) (map[string]T, int)
- func GetGravatarURL(user models.User, channel chan avatarResult, wg *sync.WaitGroup) string
- func GetOne[T any](cache *core.Cache, key string, model T) (T, bool)
- func LoadAll() string
- func Lock()
- func MarkLoaded()
- func Router() chi.Router
- func RunMigrations(l common.LoggerInterface) string
- func SetOne[T any](cache *core.Cache, key string, model T) bool
- func Unlock()
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DeleteOne ¶
DeleteOne deletes an item from such cache via the requested key value. Fails if the database state is locked.
func GetAll ¶
GetAll function does a fetch-all operation on the given cache instance. After the data retrieval, all items are to be asserted their corresponding types and to be loaded into a map[string]T map, where T is a generic type. This map and number of processed items are returned.
func GetGravatarURL ¶
GetGravatarURL function returns the avatar image location/URL, or it defaults to a app logo.
func GetOne ¶
GetOne fetches just one very item from the given cache instance. As long as the function is generic, the type is asserted automatically, so the type passing is required. Returns the requested item and the its retrieval result as boolean.
func Lock ¶ added in v0.43.2
func Lock()
Lock function ensures that the database driver is set to the readonly (RO) mode.
func MarkLoaded ¶ added in v0.44.18
func MarkLoaded()
MarkLoaded function unlock the database(s) state for the assiciated metrics updating. This means that the database has been loaded on start.
func RunMigrations ¶
func RunMigrations(l common.LoggerInterface) string
RunMigrations is a wrapper function for the migration registration and execution.
Types ¶
This section is empty.