database

package
v0.0.0-...-6f596e7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(service string)

Types

type DBConfig

type DBConfig struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Database string `mapstructure:"database"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

type GormList

type GormList struct {
	List []string `json:"val"`
}

GormList 定义了一个 GormList 类型,用于存储多个字符串

func (*GormList) Scan

func (g *GormList) Scan(value interface{}) error

Scan 实现了 sql.Scanner 接口,将数据库中的数据转换为 GormList 类型。

func (GormList) Value

func (g GormList) Value() (driver.Value, error)

Value 实现了 driver.Valuer 接口,将 GormList 类型转换为 JSON 字符串用于存储在数据库中。

Jump to

Keyboard shortcuts

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