xdb

package module
v0.0.0-...-1d2cae4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

godb

初始化数据库

Documentation

Index

Constants

View Source
const (
	MySQL      = "mysql"
	Postgresql = "postgres"
)

Variables

View Source
var (
	MaxIdle     = 500
	MaxActive   = 4000
	IdleTimeout = 30 * time.Second
	Wait        = true
)
View Source
var (
	MaxIdleConns = 50
	MaxOpenConns = 200
)

Functions

func AddRedisConfig

func AddRedisConfig(key string, rc RedisConfig)

AddRedisConfig Add redis

func AddSQLDriver

func AddSQLDriver(key string, sd SQLDriver)

func GetEngine

func GetEngine(db string) (*xorm.Engine, error)

GetEngine 获取数据库

func GetRedisPool

func GetRedisPool(key string) (*redis.Pool, error)

GetRedisPool get pool

Types

type DbLogger

type DbLogger struct {
	Logger func(format string, arg ...interface{})
}

func (DbLogger) Write

func (d DbLogger) Write(p []byte) (n int, err error)

type RedisConfig

type RedisConfig interface {
	GetHost() string
	GetPort() string
	GetAuth() string
}

RedisConfig for config

type SQLDriver

type SQLDriver interface {
	GetDatabase() string
	GetUser() string
	GetPwd() string
	GetHost() string
	GetPort() string
	GetDriver() string
}

SQLDriver driver interface

Jump to

Keyboard shortcuts

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