mysql

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

*

  • GetDB

func NewConn

func NewConn() *gorm.DB

func NewMSQLConnection

func NewMSQLConnection() *gorm.DB

*

  • NewMSQLConnection
  • 初始化 链接

func SetupDatabase

func SetupDatabase(db *gorm.DB)

setupDatabase 为了使用一些常用组建

Types

type MYSQL

type MYSQL struct {
	Name        string `json:"name"`         // 数据库名称
	Password    string `json:"password"`     // 数据库密码
	User        string `json:"user"`         // 数据库用户
	Host        string `json:"host"`         // host
	Port        string `json:"port"`         // 端口
	TablePrefix string `json:"table_prefix"` // 表前缀
	ParseTime   string `json:"parseTime"`    // 时间修改
	Loc         string `json:"loc"`          // defult Local
}

*

  • MYSQL
  • 默认PG的配置文件

func NewMYSQL

func NewMYSQL() *MYSQL

*

  • NewMYSQL
  • 初始化MYSQL dsn

func (*MYSQL) NewConnection

func (p *MYSQL) NewConnection() *gorm.DB

*

  • NewConnection
  • 创建链接
  • dsn := "user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local"

Jump to

Keyboard shortcuts

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