db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package db provide useful functions to create mysql instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMySQL

func NewMySQL(opts *MySQLOptions) (*gorm.DB, error)

NewMySQL 使用给定的选项创建一个新的 gorm 数据库实例.

Types

type MySQLOptions

type MySQLOptions struct {
	Host                  string
	Username              string
	Password              string
	Database              string
	MaxIdleConnections    int
	MaxOpenConnections    int
	MaxConnectionLifeTime time.Duration
	LogLevel              int
}

MySQLOptions 定义 MySQL 数据库的选项.

func (*MySQLOptions) DSN

func (o *MySQLOptions) DSN() string

DSN 从 MySQLOptions 返回 DSN.

Jump to

Keyboard shortcuts

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