Documentation ¶
Index ¶
- Constants
- Variables
- func ContainString(target string, slice []string) bool
- func GenInstanceId() string
- func GenPrimaryCacheKey(instanceId string, tableName string, primaryKey string) string
- func GenPrimaryCachePrefix(instanceId string, tableName string) string
- func GenSearchCacheKey(instanceId string, tableName string, sql string, vars ...any) string
- func GenSearchCachePrefix(instanceId string, tableName string) string
- func If[T any](boolExpression bool, trueReturn, falseReturn T) T
- func In[E comparable](v E, s []E) bool
- func Index[E comparable](v E, s []E) int
- func RandFloatingInt64(v int64) int64
- func ShouldCache(tableName string, tables []string) bool
- type Kv
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 GenInstanceId ¶
func GenInstanceId() string
func GenPrimaryCacheKey ¶
func GenPrimaryCachePrefix ¶
func GenSearchCacheKey ¶
func GenSearchCachePrefix ¶
func If ¶
If
@Description: if实现的三元表达式 @param boolExpression: 布尔表达式,最终返回一个布尔值 @param trueReturn: 当boolExpression返回值为true的时候返回的值 @param falseReturn: 当boolExpression返回值为false的时候返回的值 @return bool: 三元表达式的结果,为trueReturn或者falseReturn中的一个
func In ¶
func In[E comparable](v E, s []E) bool
func Index ¶
func Index[E comparable](v E, s []E) int
Index returns the index of the first occurrence of v in s, or -1 if not present.
func RandFloatingInt64 ¶
func ShouldCache ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.