database

package
v0.0.0-...-c76da00 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func GetDB

func GetDB() *gorm.DB

GetDB get database

func InitDatabase

func InitDatabase(dbi DatabaseInterface)

InitDatabase init database

Types

type DatabaseInterface

type DatabaseInterface interface {
	InitDB(migrateDst ...interface{}) (*gorm.DB, error)
}

type MysqlDatabase

type MysqlDatabase struct {
	UserName string
	Password string
	Host     string
	Port     string
	Database string
	CharSet  string
}

func (MysqlDatabase) InitDB

func (m MysqlDatabase) InitDB(migrateDst ...interface{}) (*gorm.DB, error)

InitDB init database

type SqliteDatabase

type SqliteDatabase struct {
	FilePath string
}

func (SqliteDatabase) InitDB

func (s SqliteDatabase) InitDB(migrateDst ...interface{}) (*gorm.DB, error)

InitDB init database

Jump to

Keyboard shortcuts

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