commEntity

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: GPL-3.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Factory *factory
)

Functions

func BuildMap added in v1.0.1

func BuildMap(entity IEntity) map[string]interface{}

func BuildMapList added in v1.0.1

func BuildMapList(entityList []IEntity) []map[string]interface{}

func BuildPoList added in v1.0.1

func BuildPoList(entityList []IEntity) []map[string]interface{}

func GetIDList added in v1.0.2

func GetIDList(entityList []IEntity) []int64

func GetKeyList added in v1.0.2

func GetKeyList(entityList []IEntity) []string

func GetPoReflectType

func GetPoReflectType(entityType string) (string, reflect.Type, error)

func MakeServiceKey

func MakeServiceKey(slic []string) string

MakeServiceKey Java的编码格式范例:"[mqtt-client, 范例:MQTT客户端]",注意,它带""的字符串

func SortEntityList added in v1.0.1

func SortEntityList(entityList []IEntity)

func SortMapList added in v1.0.1

func SortMapList(mapList []map[string]interface{})

Types

type BaseEntity

type BaseEntity struct {
	Id         int64 // 对象id
	CreateTime int64 // 创建时间
	UpdateTime int64 // 更新时间
}

BaseEntity 基础信息

type IEntity

type IEntity interface {
	Type() string                  // 类型名称
	GetBaseEntity() *BaseEntity    // 基础信息
	NewEntity() IEntity            // 实例化一个Entity,它的各成员部位nil
	NewPo() interface{}            // 实例化一个PO,它的各成员部位nil
	MakeServiceKey() string        // 生成string格式的key
	MakeServiceKeyList() []string  // 生成[]string格式的key
	TableName() string             // 数据库表名称,默认名称,在持久化的时候对应哪个数据库表
	BuildByJson(jsn *string) error // 构造实体
	BuildToJson() (string, error)  // 构造实体
	BuildByPo(interface{})         // 构造实体
	BuildToPo() interface{}        // 构造实体
}

IEntity 定义接口

func BuildEntityByJson

func BuildEntityByJson(entityType string, jsn *string) (IEntity, error)

func NewEntity

func NewEntity(entityType string) (IEntity, error)

Jump to

Keyboard shortcuts

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