entity

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGlobalSqliteInstance

func GetGlobalSqliteInstance(name string) *oltp.Sqlite

Types

type BaseModel

type BaseModel struct {
	types.IBaseModel `json:"-" gorm:"-"`
	*Model
	Code            string `json:"code"`
	Name            string `json:"name"`
	State           int    `json:"state"`
	Describe        string `json:"describe"`
	CreatedUser     uint   `json:"-"`
	UpdatedUser     uint   `json:"-"`
	CreatedUserName string `json:"createdusername"`
	UpdatedUserName string `json:"updatedusername"`
	TraceID         string `json:"-"`
}

BaseModel 基础模型

func NewBaseModel

func NewBaseModel() *BaseModel

func (*BaseModel) AddValid

func (own *BaseModel) AddValid() error

func (*BaseModel) Equals

func (own *BaseModel) Equals(o interface{}) bool

func (*BaseModel) GetCode

func (own *BaseModel) GetCode() string

func (*BaseModel) GetHash

func (own *BaseModel) GetHash() string

func (*BaseModel) GetID

func (own *BaseModel) GetID() uint

func (*BaseModel) IsBaseModel

func (own *BaseModel) IsBaseModel() bool

func (*BaseModel) NewModel

func (own *BaseModel) NewModel()

func (*BaseModel) RemoveValid

func (own *BaseModel) RemoveValid() error

func (*BaseModel) SetCode

func (own *BaseModel) SetCode(code string)

func (*BaseModel) UpdateValid

func (own *BaseModel) UpdateValid(old interface{}) error

type BaseModelReleaseRecord

type BaseModelReleaseRecord struct {
	*Model
	SourceID        uint `json:"sourceid,string" gorm:"column:sourceid"`
	RealeaseAddress string
	RealeaseContent string
	RealeaseState   int
}

基础数据发布记录

func NewReleaseRecord

func NewReleaseRecord() *BaseModelReleaseRecord

func (*BaseModelReleaseRecord) NewModel

func (own *BaseModelReleaseRecord) NewModel()

type BaseOrderModel

type BaseOrderModel struct {
	types.IOrderModel `json:"-" gorm:"-"`
	*Model
	TraceID string `json:"-"`
	Code    string `json:"code"`
	UserID  uint   `json:"userid,string"`
	State   int    `json:"state"`
}

BaseOrderModel 基础单据模型

func NewBaseOrderModel

func NewBaseOrderModel() *BaseOrderModel

func (*BaseOrderModel) AddValid

func (own *BaseOrderModel) AddValid() error

func (*BaseOrderModel) GetHash

func (own *BaseOrderModel) GetHash() string

func (*BaseOrderModel) NewModel

func (own *BaseOrderModel) NewModel()

func (*BaseOrderModel) RemoveValid

func (own *BaseOrderModel) RemoveValid() error

func (*BaseOrderModel) UpdateValid

func (own *BaseOrderModel) UpdateValid(old interface{}) error

type BaseRecordModel

type BaseRecordModel struct {
	types.IRecordModel `json:"-" gorm:"-"`
	*Model
	TraceID string `json:"traceid"`
}

func NewBaseRecordModel

func NewBaseRecordModel() *BaseRecordModel

func (*BaseRecordModel) AddValid

func (own *BaseRecordModel) AddValid() error

func (*BaseRecordModel) Equals

func (own *BaseRecordModel) Equals(o interface{}) bool

func (*BaseRecordModel) GetHash

func (own *BaseRecordModel) GetHash() string

func (*BaseRecordModel) RemoveValid

func (own *BaseRecordModel) RemoveValid() error

func (*BaseRecordModel) UpdateValid

func (own *BaseRecordModel) UpdateValid(old interface{}) error

type Model

type Model struct {
	ID         uint       `gorm:"primarykey" json:"id,string"`
	CreatedAt  *time.Time `json:"createdAt"`
	UpdatedAt  *time.Time `json:"updatedAt"`
	ModelState int        `gorm:"-" json:"modelState"` // 0: normal, 1: add, 2: update, 3: remove
	Hashcode   string     `gorm:"column:hashcode;type:varchar(500);uniqueIndex" json:"hashCode"`
}

func NewModel

func NewModel() *Model

func (*Model) AddValid

func (own *Model) AddValid() error

func (*Model) Equals

func (own *Model) Equals(o interface{}) bool

func (*Model) GetCreatedAt

func (own *Model) GetCreatedAt() *time.Time

func (*Model) GetField

func (own *Model) GetField(field string) interface{}

弃用,无法通过own获取子struct

func (*Model) GetHash

func (own *Model) GetHash() string

func (*Model) GetID

func (own *Model) GetID() uint

func (*Model) GetLocalDBName

func (own *Model) GetLocalDBName() string

func (*Model) GetModelState

func (own *Model) GetModelState() int

func (*Model) GetRemoteDBName

func (own *Model) GetRemoteDBName() string

func (*Model) GetUpdatedAt

func (own *Model) GetUpdatedAt() *time.Time

func (*Model) NewModel

func (own *Model) NewModel()

func (*Model) RemoveValid

func (own *Model) RemoveValid() error

func (*Model) SearchWhere

func (own *Model) SearchWhere(ws []*types.WhereItem) ([]*types.WhereItem, error)

func (*Model) SetCreatedAt

func (own *Model) SetCreatedAt(t time.Time)

func (*Model) SetField

func (own *Model) SetField(field string, value interface{}) error

弃用,无法通过own获取子struct

func (*Model) SetHashcode

func (own *Model) SetHashcode(code string)

func (*Model) SetID

func (own *Model) SetID(id uint)

func (*Model) SetModelState

func (own *Model) SetModelState(state int)

func (*Model) SetUpdatedAt

func (own *Model) SetUpdatedAt(t time.Time)

func (*Model) UpdateValid

func (own *Model) UpdateValid(old interface{}) error

type ModelList

type ModelList[T types.IModel] struct {
	// contains filtered or unexported fields
}

func NewModelList

func NewModelList[T types.IModel](action types.IDataAction) *ModelList[T]

func (*ModelList[T]) Add

func (own *ModelList[T]) Add(items ...*T) error

func (*ModelList[T]) AddArray

func (own *ModelList[T]) AddArray() []*T

func (*ModelList[T]) AddCount

func (own *ModelList[T]) AddCount() int

func (*ModelList[T]) Clear

func (own *ModelList[T]) Clear()

func (*ModelList[T]) Contains

func (own *ModelList[T]) Contains(item interface{}) (bool, uint)

Contains 是否包含该数据,如果包含,返回true,并返回ID

func (*ModelList[T]) Count

func (own *ModelList[T]) Count() int

func (*ModelList[T]) FindAll

func (own *ModelList[T]) FindAll(fn func(o *T) bool) []*T

func (*ModelList[T]) FindOne

func (own *ModelList[T]) FindOne(fn func(o *T) bool) (int, *T)

func (*ModelList[T]) ForEach

func (own *ModelList[T]) ForEach(issearch bool, fn func(o *T))

func (*ModelList[T]) Get

func (own *ModelList[T]) Get(index int) *T

func (*ModelList[T]) GetAction

func (own *ModelList[T]) GetAction() types.IDataAction

GetAction 返回底层数据操作适配器,供需要内省查询的组延方使用

func (*ModelList[T]) GetDB

func (own *ModelList[T]) GetDB() (*gorm.DB, error)

func (*ModelList[T]) GetDBAdapter

func (own *ModelList[T]) GetDBAdapter(item *types.SearchItem) types.IDataAction

func (*ModelList[T]) GetMemoryStats

func (own *ModelList[T]) GetMemoryStats() map[string]int

func (*ModelList[T]) GetSearchItem

func (own *ModelList[T]) GetSearchItem() *types.SearchItem

func (*ModelList[T]) LoadList

func (own *ModelList[T]) LoadList(item *types.SearchItem) error

func (*ModelList[T]) NewItem

func (own *ModelList[T]) NewItem() *T

func (*ModelList[T]) OnDelete

func (own *ModelList[T]) OnDelete(ada types.IDataAction, item *T) error

func (*ModelList[T]) OnInsert

func (own *ModelList[T]) OnInsert(ada types.IDataAction, item *T) error

func (*ModelList[T]) OnLoad

func (own *ModelList[T]) OnLoad(ada types.IDataAction, item *types.SearchItem) error

func (*ModelList[T]) OnUpdate

func (own *ModelList[T]) OnUpdate(ada types.IDataAction, item *T) error

func (*ModelList[T]) PreLoadList

func (own *ModelList[T]) PreLoadList(item *types.SearchItem) error

func (*ModelList[T]) ReLoadList

func (own *ModelList[T]) ReLoadList() error

func (*ModelList[T]) Remove

func (own *ModelList[T]) Remove(items ...*T) error

func (*ModelList[T]) RemoveAll

func (own *ModelList[T]) RemoveAll(fn func(o *T) bool)

func (*ModelList[T]) RemoveArray

func (own *ModelList[T]) RemoveArray() []*T

func (*ModelList[T]) Save

func (own *ModelList[T]) Save() error

func (*ModelList[T]) SearchAll

func (own *ModelList[T]) SearchAll(page, size int, fn ...func(item *types.SearchItem)) ([]*T, int64, error)

func (*ModelList[T]) SearchCode

func (own *ModelList[T]) SearchCode(code string, fn ...func(item *types.SearchItem)) (*T, error)

func (*ModelList[T]) SearchHash

func (own *ModelList[T]) SearchHash(hash string, fn ...func(item *types.SearchItem)) (*T, error)

func (*ModelList[T]) SearchId

func (own *ModelList[T]) SearchId(id uint, fn ...func(item *types.SearchItem)) (*T, error)

func (*ModelList[T]) SearchName

func (own *ModelList[T]) SearchName(name string, fn ...func(item *types.SearchItem)) ([]*T, error)

func (*ModelList[T]) SearchOne

func (own *ModelList[T]) SearchOne(fn ...func(item *types.SearchItem)) (*T, error)

func (*ModelList[T]) SearchSum

func (own *ModelList[T]) SearchSum(field string, fn ...func(item *types.SearchItem)) (decimal.Decimal, error)

统计查询,默认sum(field),当需要使用max,min,avg等统计时,需要在fn中修改item.Statistical=max

func (*ModelList[T]) SearchTraceId

func (own *ModelList[T]) SearchTraceId(traceid string, fn ...func(item *types.SearchItem)) (*T, error)

func (*ModelList[T]) SearchWhere

func (own *ModelList[T]) SearchWhere(name string, value interface{}, fn ...func(item *types.SearchItem)) ([]*T, error)

func (*ModelList[T]) SetDBAdapter

func (own *ModelList[T]) SetDBAdapter(ada types.IDataAction)

func (*ModelList[T]) SetOnDelete

func (own *ModelList[T]) SetOnDelete(fn func(item *T) error)

func (*ModelList[T]) SetOnInsert

func (own *ModelList[T]) SetOnInsert(fn func(item *T) error)

func (*ModelList[T]) SetOnLoad

func (own *ModelList[T]) SetOnLoad(fn func(item *types.SearchItem, own interface{}) error)

func (*ModelList[T]) SetOnUpdate

func (own *ModelList[T]) SetOnUpdate(fn func(item *T) error)

func (*ModelList[T]) ToArray

func (own *ModelList[T]) ToArray() []*T

func (*ModelList[T]) Update

func (own *ModelList[T]) Update(items ...*T) error

func (*ModelList[T]) UpdateArray

func (own *ModelList[T]) UpdateArray() []*T

Directories

Path Synopsis
本文件保留既有方言名称入口;数据库选择与编译已下沉。
本文件保留既有方言名称入口;数据库选择与编译已下沉。

Jump to

Keyboard shortcuts

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