ORM

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ORMCache map[int]*ORM

ORMCache保存ORM

Functions

This section is empty.

Types

type Field

type Field struct {
	FiledName string
	FiledType reflect.Type
}

属性信息

type ModelInfo

type ModelInfo struct {
	ModelType  reflect.Type
	Filed      []Field
	FiledNames []string
	NumField   int
}

model注册信息

type ORM

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

ORM 结构

func GetOrNewORM

func GetOrNewORM() *ORM

GetOrNewORM获取ORM

func (*ORM) ConnectMySQLDB

func (orm *ORM) ConnectMySQLDB(dataSource string)

ConnectMtSQLDB 连接mysql数据库

func (*ORM) Delete added in v0.3.0

func (orm *ORM) Delete(model interface{})

删除抽象

func (ORM) GetModelInfo

func (orm ORM) GetModelInfo(model interface{}) (ModelInfo, error)

GetModelInfo获取已注册模型的信息

func (*ORM) Insert

func (orm *ORM) Insert(model interface{})

func (*ORM) Query

func (orm *ORM) Query(model interface{}) []reflect.Value

Query查询抽象

func (*ORM) RawSQLExec added in v0.3.0

func (orm *ORM) RawSQLExec(Sql string) sql.Result

原始SQL输入

func (*ORM) RegistModel

func (orm *ORM) RegistModel(model interface{})

RegistModel注册模型

func (*ORM) ResetAndSyncDB

func (orm *ORM) ResetAndSyncDB(force bool)

数据库同步,根据force来判断是否重置数据库

func (*ORM) Update

func (orm *ORM) Update(model interface{})

Update更新抽象

Jump to

Keyboard shortcuts

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