xgodbkv

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: BSD-3-Clause-Clear Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetId

func GetId(value string) uint

KV换取ID信息

value	待查询的信息

func GetValue

func GetValue(id uint) string

KV换取VALUE信息

id	待查询的ID值

Types

type Config

type Config struct {
	DB      *gorm.DB
	KVTable string // 配置表名称
}

数据库相关配置

var DefaultConfig Config = Config{
	KVTable: "key_value",
}

默认配置表所在的配置

type KeyValue

type KeyValue struct {
	Id        uint   `gorm:"column:id;primaryKey;type:BIGINT UNSIGNED;not null;autoIncrement" json:"id" form:"id"`
	Fid       uint   `gorm:"column:fid;type:BIGINT UNSIGNED;not null;index;default:0" json:"fid" form:"fid"` //上级分类编号(数据分析时使用)
	Value     string `gorm:"column:value;type:varchar(200);unique" json:"value" form:"value"`                //对应的值
	CreatedAt string `gorm:"column:created_at;type:datetime" json:"created_at" form:"created_at"`
}

func (*KeyValue) TableName

func (c *KeyValue) TableName() string

获取表名

Jump to

Keyboard shortcuts

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