respond

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	UUKey  string `json:"uukey"`
	Model  string `json:"model"`
	LogID  string `json:"logid"`
	OpType string `json:"opType,omitempty"`
	Action string `json:"action,omitempty"`

	Exists bool   `json:"exists"` // 是否存在
	System object `json:"system"` // 系统数据
	Unique object `json:"unique"` // 唯一数据

	Default object `json:"default"` // 存储时的默认数据
	Request object `json:"request"` // 请求过来的数据
	Storage object `json:"storage"` // 数据库存储的数据
	Prepare object `json:"prepare"` // 数据处理合并数据
	// 以下数据都是基于 Storage 数据计算的
	Current object `json:"current"` // 数据库对象准换成扁平数据
	Changed object `json:"changed"` // 合并后对象最终扁平数据
	Changes object `json:"changes"` // 数据处理改动数据
	Objects object `json:"objects"` // 多层嵌套的对象数据
}

func (*Record) Decode

func (self *Record) Decode(skma schema.ISchema, data object) object

mysql json string 字段需要解析成 json object

func (*Record) Encode

func (self *Record) Encode(skma schema.ISchema, data object) object

mysql json object 字段需要编码成 json string

func (*Record) ExpandTime

func (self *Record) ExpandTime(skma schema.ISchema, date *time.Time) object

ExpandTime 根据 utime 解析出的时间,扩展出:

  • uweek:ISO 周序号,YYYYWW,如 202552 表示 2025 年第 52 周;
  • uterm:财务期间,YYYYMM,期间为「上月 start 日 ~ 本月 start-1 日」归属「本月」, 例如 start=26 时 12/26~1/25 属 1 月期间(202601)。

func (*Record) FillNilData

func (self *Record) FillNilData(skma schema.ISchema, request object) object

FillNilData 在扁平请求(如 basic.name)上, 为 schema 中应有但未出现的字段补上 nil, 便于 parse/后续合并把「未传」与「不传」区分开。

func (*Record) Format

func (self *Record) Format(skma schema.ISchema, data object) object

*

  • storage data format
  • not nested data
  • not flatten data

func (*Record) GetRelated

func (self *Record) GetRelated(group *source.Group) *request.Record

func (*Record) GetUUKey

func (self *Record) GetUUKey(skma *schema.Input) string

func (*Record) GetUnique

func (self *Record) GetUnique(skma *schema.Input) object

func (*Record) PickObject

func (self *Record) PickObject(group *source.Group, data object) object

func (*Record) ToChanges

func (self *Record) ToChanges(skma schema.ISchema, flatten object) object

func (*Record) ToCurrent

func (self *Record) ToCurrent(skma schema.ISchema, data object) object

func (*Record) ToFlatten

func (self *Record) ToFlatten(skma schema.ISchema, objects object) object

func (*Record) ToIndexed

func (self *Record) ToIndexed(skma schema.ISchema) object

func (*Record) ToObjects

func (self *Record) ToObjects(skma schema.ISchema, data object) object

func (*Record) ToPrepare

func (self *Record) ToPrepare(skma schema.ISchema, flatten object) object

type Result

type Result struct {
	Page  uint16 `json:"page"`
	Size  uint16 `json:"size"`
	Count uint64 `json:"count"`

	Refers object `json:"refers"` // 引用数据
	Totals object `json:"totals"` // 汇总数据

	Values []object `json:"values"` // 返回数据
}

func (*Result) Sort

func (self *Result) Sort(order *request.Order)

Jump to

Keyboard shortcuts

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