dbtools

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Core

func Core() *gorm.DB

func DB

func DB(name string) *gorm.DB

func DoInitModels

func DoInitModels(imfs ...InitModelFunc) error

DoInitModels 使用默认db初始化模型

func DoInitModelsWithDB added in v0.3.3

func DoInitModelsWithDB(db *gorm.DB, imfs ...InitModelWithDBFunc) error

DoInitModelsWithDB 使用db参数初始化模型

func InitModel

func InitModel(db *gorm.DB, models ...interface{}) error

InitModel 工具类,自动生成表结构,gorm中的AutoMIGRATE

func InitMutilMySQL

func InitMutilMySQL(dburls map[string]string) error

func InitMySQL

func InitMySQL(name, dburl string) (*gorm.DB, error)

func InitSQLite

func InitSQLite(name, dburl string) (*gorm.DB, error)

func InsertOrUpdate

func InsertOrUpdate(db *gorm.DB, v interface{}, columns ...string) error

func Std

func Std() *gorm.DB

Types

type InitModelFunc

type InitModelFunc func() error

type InitModelWithDBFunc added in v0.3.3

type InitModelWithDBFunc func(db *gorm.DB) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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