database

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

DB is a global variable for database

Functions

func GetDB

func GetDB() *gorm.DB

GetDB get database

func InitDatabase

func InitDatabase(dbi DBInterface)

InitDatabase init database

Types

type DBInterface

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

DBInterface is an interface for database

type MysqlDatabase

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

MysqlDatabase mysql database struct

func (MysqlDatabase) InitDB

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

InitDB init database

type SqliteDatabase

type SqliteDatabase struct {
	FilePath string
}

SqliteDatabase sqlite database struct

func (SqliteDatabase) InitDB

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

InitDB init database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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