rdb

package
v0.0.0-...-cad48ee Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelInfo  = LogLevel(logger.Info)
	LogLevelError = LogLevel(logger.Error)

	DBMSMySQL      = DBMS("mysql")
	DBMSPostgreSQL = DBMS("postgres")
)
View Source
const (
	MysqlDSN    = "%s:%s@(%s:%s)/%s?charset=utf8mb4&parseTime=true"
	PostgresDSN = "host=%s user=%s password=%s dbname=%s port=%s sslmode=disable"

	ErrStrUnkownDBMS = "unknown DBMS: %s"
)
View Source
const TestDriver = "txdb"

Variables

This section is empty.

Functions

func InitTest

func InitTest(c TestConfig) error

func New

func New(c Config) (*gorm.DB, error)

func NewTest

func NewTest(dbms DBMS, name string) (*gorm.DB, error)

Types

type Config

type Config struct {
	DBMS        DBMS
	Conn        Connection
	LogLevel    LogLevel
	MaxIdleConn int
	MaxOpenConn int
	MaxLifetime time.Duration
}

type Connection

type Connection struct {
	User     string
	Password string
	Host     string
	Port     string
	Database string
}

type DBMS

type DBMS string

type LogLevel

type LogLevel logger.LogLevel

type TestConfig

type TestConfig struct {
	DBMS DBMS
	Conn Connection
}

Jump to

Keyboard shortcuts

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