store

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

@Title @Description @Author Wangwengang 2023/12/12 23:57 @Update Wangwengang 2023/12/12 23:57

@Title @Description @Author Wangwengang 2023/12/23 19:14 @Update Wangwengang 2023/12/23 19:14

@Title @Description @Author Wangwengang 2023/12/25 05:11 @Update Wangwengang 2023/12/25 05:11

@Title @Description @Author Wangwengang 2023/12/12 23:55 @Update Wangwengang 2023/12/12 23:55

@Title @Description @Author Wangwengang 2023/12/12 23:58 @Update Wangwengang 2023/12/12 23:58

@Title @Description @Author Wangwengang 2023/12/12 23:58 @Update Wangwengang 2023/12/12 23:58

@Title @Description @Author Wangwengang 2023/12/23 12:21 @Update Wangwengang 2023/12/23 12:21

@Title @Description @Author Wangwengang 2023/12/25 05:16 @Update Wangwengang 2023/12/25 05:16

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseMongoClient

func CloseMongoClient()

func DBList

func DBList(config *[]sconfig.SpecializedDB, log slog.Slog) map[string]*gorm.DB

func GormMysqlByConfig

func GormMysqlByConfig(m sconfig.Mysql, log slog.Slog) *gorm.DB

GormMysqlByConfig 初始化Mysql数据库用过传入配置

func GormPgSqlByConfig added in v1.0.2

func GormPgSqlByConfig(p sconfig.Pgsql, log slog.Slog) *gorm.DB

GormPgSqlByConfig 初始化PostgreSQL数据库通过传入配置

func TODO

func TODO() string

proto 生成go文件引入所用

Types

type BASE_MODEL

type BASE_MODEL struct {
	ID        int64          `gorm:"primarykey" json:"ID"` // 主键ID
	CreatedAt time.Time      // 创建时间
	UpdatedAt time.Time      // 更新时间
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
}

type EtcdBase

type EtcdBase struct {
	EtcdCli *clientv3.Client
}

type HashMap

type HashMap struct {
	Keyformat string
}

func (*HashMap) Delete

func (h *HashMap) Delete(id int64) error

func (*HashMap) GetKeyFormat

func (h *HashMap) GetKeyFormat() string

func (*HashMap) HGet

func (h *HashMap) HGet(id int64) (string, error)

func (*HashMap) HSet

func (h *HashMap) HSet(id int64, data interface{}) error

func (*HashMap) SetKeyFormat

func (h *HashMap) SetKeyFormat(format string)

type KV

type KV struct {
	*RedisBase
	// contains filtered or unexported fields
}

func NewKV

func NewKV(redisBase *RedisBase, keyformat string, expire time.Duration, keepTTL bool) *KV

func (*KV) Del

func (kv *KV) Del(id int64) error

func (*KV) Expire

func (kv *KV) Expire(id int64) error

重新计算过期时间,并获取值

func (*KV) Get

func (kv *KV) Get(id int64) (string, error)

func (*KV) Set

func (kv *KV) Set(id int64, data interface{}) error

type MongoDB

type MongoDB struct {
	*mongo.Client
}

func MongoIns

func MongoIns() *MongoDB

func NewMongoClient

func NewMongoClient(mongoURI string) (*MongoDB, error)

type RedisBase

type RedisBase struct {
	RedisCli *redis.Client
}

func NewCache

func NewCache(config sconfig.Redis) *RedisBase

func RedisIns

func RedisIns() *RedisBase

func (*RedisBase) GetHash

func (r *RedisBase) GetHash(k int64) int64

type RedisHash

type RedisHash struct {
	*RedisBase
	// contains filtered or unexported fields
}

func NewRedisHash

func NewRedisHash(redisBase *RedisBase, keyformat string) *RedisHash

func (*RedisHash) HDel

func (rh *RedisHash) HDel(id int64) error

func (*RedisHash) HGet

func (rh *RedisHash) HGet(id int64) (string, error)

func (*RedisHash) HSet

func (rh *RedisHash) HSet(id int64, data interface{}) error

Directories

Path Synopsis
@Title @Description @Author Wangwengang 2023/12/13 00:04 @Update Wangwengang 2023/12/13 00:04
@Title @Description @Author Wangwengang 2023/12/13 00:04 @Update Wangwengang 2023/12/13 00:04

Jump to

Keyboard shortcuts

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