31 lines
480 B
Go
31 lines
480 B
Go
package cache
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/datatypes"
|
|
)
|
|
|
|
type KVModel struct {
|
|
Key string `gorm:"primaryKey"`
|
|
Value datatypes.JSON
|
|
ExpiresAt *time.Time
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
func (KVModel) TableName() string {
|
|
return "cache_kv"
|
|
}
|
|
|
|
type HashModel struct {
|
|
Key string `gorm:"primaryKey"`
|
|
Field string `gorm:"primaryKey"`
|
|
Value datatypes.JSON
|
|
CreatedAt time.Time
|
|
ExpiresAt *time.Time
|
|
}
|
|
|
|
func (HashModel) TableName() string {
|
|
return "cache_hash"
|
|
}
|