entity

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: AGPL-3.0 Imports: 5 Imported by: 35

Documentation

Index

Constants

View Source
const (
	EntityState_New      string = "New"
	EntityState_Modified string = "Modified"
	EntityState_Deleted  string = "Deleted"
	EntityState_None     string = "None"
)
View Source
const (
	EntityStatus_Draft     string = "Draft"
	EntityStatus_Effective string = "Effective"
	EntityStatus_Expired   string = "Expired"
	EntityStatus_Deleted   string = "Deleted"
	EntityStatus_Canceled  string = "Canceled"
	EntityStatus_Checking  string = "Checking"
	EntityStatus_Undefined string = "Undefined"
	EntityStatus_Locked    string = "Locked"
	EntityStatus_Checked   string = "Checked"
	EntityStatus_Unchecked string = "Unchecked"
	EntityStatus_Disable   string = "Disable"
	EntityStatus_Discarded string = "Discarded"
	EntityStatus_Merged    string = "Merged"
	EntityStatus_Reversed  string = "Reversed"
)
View Source
const (
	FieldName_Id         string = "Id"
	FieldName_TopId      string = "TopId"
	FieldName_Kind       string = "Kind"
	FieldName_SpecId     string = "SpecId"
	FieldName_ParentId   string = "ParentId"
	FieldName_SchemaName string = "SchemaName"
	FieldName_State      string = "State"
	FieldName_DirtyFlag  string = "DirtyFlag"
)
View Source
const (
	JsonFieldName_Id         string = "id"
	JsonFieldName_TopId      string = "topId"
	JsonFieldName_Kind       string = "kind"
	JsonFieldName_SpecId     string = "specId"
	JsonFieldName_ParentId   string = "parentId"
	JsonFieldName_SchemaName string = "schemaName"
	JsonFieldName_State      string = "state"
	JsonFieldName_DirtyFlag  string = "dirtyFlag"
	JsonFieldName_Path       string = "path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEntity

type BaseEntity struct {
	Id         uint64     `xorm:"pk" json:"id,omitempty"`
	CreateDate *time.Time `xorm:"created" json:"createDate,omitempty"`
	UpdateDate *time.Time `xorm:"updated" json:"updateDate,omitempty"`
	EntityId   string     `xorm:"-" json:"entityId,omitempty"`
	State      string     `xorm:"-" json:"state,omitempty"`
}

func (*BaseEntity) Json

func (this *BaseEntity) Json() ([]byte, error)

func (*BaseEntity) Map

func (this *BaseEntity) Map() map[string]interface{}

func (*BaseEntity) SetId

func (this *BaseEntity) SetId(id uint64)

func (*BaseEntity) UpdateState

func (this *BaseEntity) UpdateState(state string)

type DeletedEntity

type DeletedEntity struct {
	BaseEntity `xorm:"extends"` //`gorm:"embedded"`
	DeleteDate *time.Time       `xorm:"deleted" json:"deleteDate,omitempty"`
}

type EntityContext

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

func BuildEntityContext

func BuildEntityContext(entity interface{}) *EntityContext

func (*EntityContext) GetEntityDiff

func (this *EntityContext) GetEntityDiff(entity interface{}) (*EntityDiff, error)

func (*EntityContext) GetSyncInfo

func (this *EntityContext) GetSyncInfo(snapshots map[string]*EntitySnapshot) (map[string]*EntityDiff, error)

func (*EntityContext) RegisterEntity

func (this *EntityContext) RegisterEntity(entity interface{})

type EntityDiff

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

type EntitySnapshot

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

* 以下是对数据进行比较的代码

func NewSnapshot

func NewSnapshot(entity interface{}) *EntitySnapshot

type IBaseEntity

type IBaseEntity interface {
	SetId(id uint64)
	UpdateState(state string)
	Json() ([]byte, error)
	Map() map[string]interface{}
}

type Sequence

type Sequence struct {
	Name       string `xorm:"pk" json:"name,omitempty"`
	MinValue   uint64 `xorm:"notnull" json:"minvalue,omitempty"`
	Increment  uint64 `xorm:"notnull" json:"increment,omitempty"`
	CurrentVal uint64 `xorm:"notnull" json:"currentval,omitempty"`
}

* 活动会话的数据

func (Sequence) IdName

func (Sequence) IdName() string

func (Sequence) TableName

func (Sequence) TableName() string

type Session

type Session struct {
	BaseEntity `xorm:"extends"`
	SessionId  string     `xorm:"varchar(255) notnull" json:",omitempty"`
	Status     string     `xorm:"varchar(16)" json:",omitempty"`
	StatusDate *time.Time `json:",omitempty"`
	LifeTime   int64      `json:",omitempty"`
}

* 活动会话的数据

func (Session) IdName

func (Session) IdName() string

func (Session) TableName

func (Session) TableName() string

type SessionData

type SessionData struct {
	BaseEntity `xorm:"extends"`
	SessionId  string     `xorm:"varchar(255) notnull" json:",omitempty"`
	Key        string     `xorm:"varchar(512)" json:",omitempty"`
	Value      string     `xorm:"varchar(32000)" json:",omitempty"`
	ValueType  string     `xorm:"varchar(32000)" json:",omitempty"`
	Status     string     `xorm:"varchar(16)" json:",omitempty"`
	StatusDate *time.Time `json:",omitempty"`
	LifeTime   int64      `json:",omitempty"`
}

func (SessionData) IdName

func (SessionData) IdName() string

func (SessionData) TableName

func (SessionData) TableName() string

type StatusEntity

type StatusEntity struct {
	BaseEntity   `xorm:"extends"`
	Status       string     `xorm:"varchar(16)" json:"status,omitempty"`
	StatusReason string     `xorm:"varchar(255)" json:"statusReason,omitempty"`
	StatusDate   *time.Time `json:"statusDate,omitempty"`
}

type UserEntity

type UserEntity struct {
	BaseEntity   `xorm:"extends"`
	CreateUserId string `xorm:"varchar(32)" json:"createUserId,omitempty"`
	UpdateUserId string `xorm:"varchar(32)" json:"updateUserId,omitempty"`
}

type VersionEntity

type VersionEntity struct {
	BaseEntity `xorm:"extends"`
	Version    int `xorm:"version" json:"version,omitempty"`
}

Jump to

Keyboard shortcuts

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