gorm

package
v1.5.23 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 12

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
)

Functions

func BulkInsert added in v1.5.9

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

@desc 批量插入 不对唯一索引做更新 @auth liuguoqiang 2020-11-27 @param @return

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-11-27 @param @return

func Close added in v1.5.7

func Close()

func GetORM

func GetORM(dbname ...string) *gorm.DB

GetORM 获取默认的Gorm实例 目前仅支持 不传 或者仅传一个 dbname

func NewOrUpdateDB added in v1.5.7

func NewOrUpdateDB(dbname string) error

NewOrUpdateDB 初始化或更新Gorm

func SetDefaultName added in v1.1.6

func SetDefaultName(dbName string)

SetDefaultName 设置默认DB Name

func UpdateDB added in v1.1.6

func UpdateDB(dbname string) error

Deprecated 推荐使用:NewOrUpdateDB Updata 更新Gorm集成新建

Types

type Client added in v1.5.3

type Client struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB(dbname string) (g *Client)

初始化Gorm

Jump to

Keyboard shortcuts

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