database

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanCache added in v0.1.2

func CleanCache() error

func ConnectToMySQL

func ConnectToMySQL(dc *DatabaseConfig) *sql.DB

func ConnectToMySQLWithDb added in v0.3.1

func ConnectToMySQLWithDb(dc *DatabaseConfig, dbName string) *sql.DB

func GetRedisCache added in v0.3.2

func GetRedisCache(key string) (string, error)

func MustExec

func MustExec(result sql.Result, err error) (sql.Result, error)

func SQLQueryRetrieveMap

func SQLQueryRetrieveMap(db *sql.DB, query string, args ...interface{}) ([]map[string]interface{}, error)

func SQLQueryRetrieveMapNoCache

func SQLQueryRetrieveMapNoCache(db *sql.DB, query string, args ...interface{}) ([]map[string]interface{}, error)

func SQLQueryRetrieveStruct

func SQLQueryRetrieveStruct(db *sql.DB, rowStruct interface{}, query string, args ...interface{}) error

func SetLogger added in v0.3.1

func SetLogger(l *log.Logger)

func SetRedis added in v0.3.2

func SetRedis(r *redis.Client)

func SetRedisCache added in v0.3.2

func SetRedisCache(key string, value string) error

func SetRedisWithExpiration added in v0.3.2

func SetRedisWithExpiration(r *redis.Client, expiration time.Duration)

Types

type DatabaseConfig added in v0.3.0

type DatabaseConfig struct {
	Driver   string            `json:"driver"`
	Host     string            `json:"host"`
	Port     string            `json:"port"`
	Username string            `json:"username"`
	Password string            `json:"password"`
	Args     map[string]string `json:"args"`
}

Jump to

Keyboard shortcuts

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