2024-12-12 17:39:04 +08:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gorm.io/gorm"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
CachingFunc func(tx *gorm.DB) (any, error)
|
|
|
|
|
|
|
|
CacheOptions struct {
|
|
|
|
dependSQL string
|
|
|
|
dependArgs []any
|
|
|
|
}
|
|
|
|
|
|
|
|
CacheOption func(o *CacheOptions)
|
|
|
|
|
|
|
|
cacheEntry struct {
|
|
|
|
storeValue any
|
2024-12-13 10:37:09 +08:00
|
|
|
compareValue string
|
2024-12-12 17:39:04 +08:00
|
|
|
createdAt time.Time
|
|
|
|
lastChecked time.Time
|
|
|
|
}
|
|
|
|
)
|