orm

package
v0.0.0-...-2e9e358 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDao

type BaseDao struct {
	ObjModel   BaseModelInterface
	ObjType    reflect.Type
	OrmAdapter OrmAdapterInterface
}

func (*BaseDao) CreateModelObject

func (this *BaseDao) CreateModelObject() BaseModelInterface

func (*BaseDao) CreateModelSlice

func (this *BaseDao) CreateModelSlice(len int, cap int) interface{}

func (*BaseDao) DeleteByFilter

func (this *BaseDao) DeleteByFilter(col string, val interface{}) error

func (*BaseDao) DeleteOneById

func (this *BaseDao) DeleteOneById(id interface{}) error

func (*BaseDao) FindOneByFilter

func (this *BaseDao) FindOneByFilter(col string, val interface{}, structColsParams ...*pkReflect.StructSelCols) (BaseModelInterface, error)

func (*BaseDao) FindOneByFilters

func (this *BaseDao) FindOneByFilters(colVals map[string]interface{}, structColsParams ...*pkReflect.StructSelCols) (BaseModelInterface, error)

func (*BaseDao) FindOneById

func (this *BaseDao) FindOneById(id interface{}) (BaseModelInterface, error)

func (*BaseDao) FindOneBySql

func (this *BaseDao) FindOneBySql(selSql string, val ...interface{}) (ret BaseModelInterface, e error)

func (*BaseDao) Insert

func (this *BaseDao) Insert(ob BaseModelInterface, structColsParams ...*pkReflect.StructSelCols) error

func (*BaseDao) SelectSelSqlList

func (this *BaseDao) SelectSelSqlList(partSql string, pageable *beans.Pageable, userData interface{}, cb SelectListCallback) (resultListPointer interface{}, total int64, e error)

func (*BaseDao) UpdateByFilter

func (this *BaseDao) UpdateByFilter(ob BaseModelInterface, col string, val interface{}, structColsParams ...*pkReflect.StructSelCols) error

func (*BaseDao) UpdateById

func (this *BaseDao) UpdateById(ob BaseModelInterface, id interface{}, structColsParams ...*pkReflect.StructSelCols) error

type BaseDaoInterface

type BaseDaoInterface interface {
	CreateModelObject() BaseModelInterface

	CreateModelSlice(len int, cap int) interface{} // create type is: *[]BaseModel
	FindOneById(id interface{}) (BaseModelInterface, error)
	FindOneByFilter(col string, val interface{}, structColsParams ...*pkReflect.StructSelCols) (BaseModelInterface, error)
	FindOneByFilters(colVals map[string]interface{}, structColsParams ...*pkReflect.StructSelCols) (BaseModelInterface, error)
	FindOneBySql(selSql string, val ...interface{}) (BaseModelInterface, error)
	UpdateByFilter(ob BaseModelInterface, col string, val interface{}, structColsParams ...*pkReflect.StructSelCols) error
	UpdateById(ob BaseModelInterface, id interface{}, structColsParams ...*pkReflect.StructSelCols) error
	Insert(ob BaseModelInterface, structColsParams ...*pkReflect.StructSelCols) error
	SelectSelSqlList(partSql string, pageable *beans.Pageable, userData interface{}, cb SelectListCallback) (resultListPointer interface{}, total int64, e error)
	DeleteOneById(id interface{}) error
	DeleteByFilter(col string, val interface{}) error
}

func CreateBaseDao

func CreateBaseDao(v BaseModelInterface, ormAdapters ...OrmAdapterInterface) (dao BaseDaoInterface)

type BaseModel

type BaseModel struct {
}

func (*BaseModel) FilterValue

func (this *BaseModel) FilterValue()

func (*BaseModel) IdColumn

func (this *BaseModel) IdColumn() string

func (*BaseModel) SelSql

func (this *BaseModel) SelSql() string

func (*BaseModel) TableName

func (this *BaseModel) TableName() string

type BaseModelInterface

type BaseModelInterface interface {
	TableName() string
	IdColumn() string
	FilterValue()
	SelSql() string
}

type ListRawHelper

type ListRawHelper struct {
	OrmAdapter OrmAdapterInterface
	Pageable   *beans.Pageable
	Where      string
	WhereArgs  []interface{}
	ObjModel   BaseModelInterface
	UserData   interface{}
}

func (*ListRawHelper) SelSqlListQuery

func (this *ListRawHelper) SelSqlListQuery(selSql string, resultListPointer interface{}) (total int64, e error)

func (*ListRawHelper) SetCondArrEqu

func (this *ListRawHelper) SetCondArrEqu(condKey string, valueType ValueType, dbKeys ...string)

func (*ListRawHelper) SetCondArrLike

func (this *ListRawHelper) SetCondArrLike(condKey string, dbKeys ...string)

func (*ListRawHelper) SetCondArrParam

func (this *ListRawHelper) SetCondArrParam(condKey string, trueLikeFalseEqual bool, valueType ValueType, dbKeys ...string)

type OrmAdapterInterface

type OrmAdapterInterface interface {
	RegModel(model BaseModelInterface)

	ExecSql(sql string, val ...interface{}) error
	QueryOneBySql(outputRecord interface{}, sql string, val ...interface{}) error
	QueryBySql(outputRecords interface{}, sql string, val ...interface{}) error

	SqlInArg(arg interface{}) interface{}
	SqlReturnSql() string
	SqlLimitStyle() string
}
var DefaultOrmAdapter OrmAdapterInterface

type SelectListCallback

type SelectListCallback func(listRawHelper *ListRawHelper) error

type ValueType

type ValueType int
const (
	String ValueType = iota
	Int64
	Int
	InSqlStrVar
)

iota 初始化后会自动递增

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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