repository

package
v0.0.0-...-a65daed Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBUser     = "user"
	DBPass     = "pass"
	DBProtocol = "tcp(127.0.0.1:3306)"
	DBName     = "test_database"
)

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

GetDB gets db instance.

func InitDB

func InitDB()

Types

type Config

type Config struct {
	DB struct {
		Local      DBConfig
		Production DBConfig
	}
}

func NewConfig

func NewConfig() *Config

type DB

type DB struct {
	Host       string
	Username   string
	Password   string
	DBName     string
	Port       int
	Connection *gorm.DB
}

func (*DB) Begin

func (d *DB) Begin() *gorm.DB

Begin begins a transaction

func (*DB) Connect

func (d *DB) Connect() *gorm.DB

type DBConfig

type DBConfig struct {
	Host     string
	Username string
	Password string
	DBName   string
	Port     int // TODO type
}

Jump to

Keyboard shortcuts

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