gorm

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRecordNotFound record not found error, happens when haven't find any matched data when looking up with a struct
	ErrRecordNotFound = gorm.ErrRecordNotFound
	// ErrInvalidSQL invalid SQL error, happens when you passed invalid SQL
	ErrInvalidSQL = gorm.ErrInvalidSQL
	// ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback`
	ErrInvalidTransaction = gorm.ErrInvalidTransaction
	// ErrCantStartTransaction can't start transaction when you are trying to start one with `Begin`
	ErrCantStartTransaction = gorm.ErrCantStartTransaction
	// ErrUnaddressable unaddressable value
	ErrUnaddressable = gorm.ErrUnaddressable
)
View Source
var Gorm sync.Map

Functions

func BulkSave added in v1.3.0

func BulkSave(db *gorm.DB, table string, fields []string, params []map[string]interface{}) error

@desc 批量保存 如果唯一索引重复则更新,唯一索引不重复或者不存在唯一索引则插入 @auth liuguoqiang 2020-04-21 @param @return

func GetORM

func GetORM() *gorm.DB

获取默认的Gorm实例

func GetORMByName

func GetORMByName(dbname string) *gorm.DB

通过名称获取Gorm实例

func NewDB

func NewDB(dbname string)

初始化Gorm

func SetDefaultName

func SetDefaultName(dbname string)

设置获取db的默认值

func UpdateDB

func UpdateDB(dbname string) error

初始化Gorm

Types

This section is empty.

Jump to

Keyboard shortcuts

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