db

package
v0.0.0-...-1ae172a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMysqlDb

func NewMysqlDb(c *MysqlConfig) (db *gorm.DB, err error)

func NewRedisClient

func NewRedisClient(c *RedisConfig) (*redis.Client, error)

func Scan

func Scan(value interface{}, objPtr interface{}) error

func Value

func Value(object interface{}) (driver.Value, error)

Value return json value, implement driver.Valuer interface

Types

type Config

type Config struct {
	Mysql *MysqlConfig
	Redis *RedisConfig
}

type DB

type DB struct {
	Instance      *gorm.DB
	RedisInstance *redis.Client
	// contains filtered or unexported fields
}

func NewDB

func NewDB(c *Config) (*DB, error)

type MysqlConfig

type MysqlConfig struct {
	Username string
	Password string
	Host     string
	DbName   string
}

type RedisConfig

type RedisConfig struct {
	Addr     string
	Password string
	DB       int
}

Jump to

Keyboard shortcuts

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