gorm

package
v0.0.0-...-ab75adb Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB) error

AutoMigrate 自动映射数据表

func Inject

func Inject(container *dig.Container) error

Inject 注入gorm实现 使用方式:

container := dig.New()
Inject(container)
container.Invoke(func(foo IDemo) {
})

func NewDB

func NewDB(c *Config) (*gorm.DB, error)

NewDB 创建DB实例

func SetTablePrefix

func SetTablePrefix(prefix string)

SetTablePrefix 设定表名前缀

Types

type Config

type Config struct {
	Debug        bool
	DBType       string
	DSN          string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
}

Config 配置参数

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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