gormdb

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MYSQL    = "mysql"
	POSTGRES = "postgres"
	SQLite   = "sqlite3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*gorm.DB `init:"entity"`
	Conf     DatabaseConfig `init:"config"`
}

func (*DB) Table

func (db *DB) Table(name string) *gorm.DB

type DatabaseConfig

type DatabaseConfig struct {
	Type, Charset, Database, Schema, TimeZone string
	Host                                      string `flag:"name:db_host;usage:数据库host"`
	User, Password                            string
	TimeFormat                                string
	MaxIdleConns, MaxOpenConns                int
	Port                                      int32
	//bug 字段gorm toml不生效
	Gorm       gormi.GORMConfig
	Prometheus bool
}

func (*DatabaseConfig) Build

func (conf *DatabaseConfig) Build(dialector gorm.Dialector) *gorm.DB

func (*DatabaseConfig) Init

func (c *DatabaseConfig) Init()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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