util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GormCachePrefix = "gormcache"
)

Variables

View Source
var ErrCacheLoadFailed = errors.New("cache hit, but load value error")
View Source
var ErrCacheUnmarshal = errors.New("cache hit, but unmarshal error")
View Source
var PrimaryCacheHit = errors.New("primary cache hit")
View Source
var SearchCacheHit = errors.New("search cache hit")

Functions

func ContainString

func ContainString(target string, slice []string) bool

func GenInstanceId

func GenInstanceId() string

func GenPrimaryCacheKey

func GenPrimaryCacheKey(instanceId string, tableName string, primaryKey string) string

func GenPrimaryCachePrefix

func GenPrimaryCachePrefix(instanceId string, tableName string) string

func GenSearchCacheKey

func GenSearchCacheKey(instanceId string, tableName string, sql string, vars ...any) string

func GenSearchCachePrefix

func GenSearchCachePrefix(instanceId string, tableName string) string

func RandFloatingInt64

func RandFloatingInt64(v int64) int64

func ShouldCache

func ShouldCache(tableName string, tables []string) bool

Types

type Kv

type Kv struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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