orm

package
v2.1.41 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 14 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
	// ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback`
	ErrInvalidTransaction = gorm.ErrInvalidTransaction
)

Functions

func BulkInsert

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

Deprecated BulkInsert 批量插入 不对唯一索引做更新

func BulkSave

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

Deprecated BulkSave 批量插入 如果唯一索引重复则更新,唯一索引不重复或者不存在唯一索引则插入

func Close

func Close()

func GetORM

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

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

func NewOrUpdateDB

func NewOrUpdateDB(dbname string) error

NewOrUpdateDB initialize or update db session

func SetDefaultName

func SetDefaultName(dbName string)

Types

type Client

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

func NewDB

func NewDB(dbname string) (g *Client)

NewDB initialize db session

Jump to

Keyboard shortcuts

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