bootstrap

package
v0.0.0-...-69e4d83 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *logrus.Logger

Functions

func CreateLogstashConnection

func CreateLogstashConnection(serviceName string)

func CreateMySQLConnection

func CreateMySQLConnection(conf *configs.MySQLConn) *gorm.DB

func CreateRedisConnection

func CreateRedisConnection(conf *configs.RedisConn) redis.UniversalClient

CreateRedisConnection make connection example database, _ := strconv.Atoi(os.Getenv("REDIS_DB"))

bootstrap.CreateRedisConnection(&redis.UniversalOptions{
 Addrs:       strings.Split(os.Getenv("REDIS_HOST"), ","),
 Password:    os.Getenv("REDIS_PASSWORD"),
 DB:          database,
 DialTimeout: time.Duration(15) * time.Second,
 ConnectionName: "test" // empty is default
})

new(bootstrap).DB().Get().... new(bootstrap).DB("test").Get()....

Types

type MySQL

type MySQL struct {
}

MySQL mysql database management

func (*MySQL) DB

func (c *MySQL) DB(connectionNames ...string) *gorm.DB

DB get mysql connection

func (*MySQL) HealthCheck

func (c *MySQL) HealthCheck(connectionNames ...string) string

type RedisDB

type RedisDB struct {
}

RedisDB database management

func (*RedisDB) DB

func (c *RedisDB) DB(connectionNames ...string) redis.UniversalClient

DB get redis connection

func (*RedisDB) HealthCheck

func (c *RedisDB) HealthCheck(connectionNames ...string) string

Jump to

Keyboard shortcuts

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