model

package
v0.0.0-...-b92f783 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CommonPrefix = "zd_"
	Models       = []interface{}{
		&ZdExcel{},
		&ZdDef{}, &ZdField{}, &ZdSection{}, &ZdRefer{},
		&ZdRanges{}, &ZdRangesItem{}, &ZdText{}, &ZdConfig{}, &ZdInstances{}, &ZdInstancesItem{},
		&ZdMock{}, &ZdMockSampleSrc{},
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Version  float64
	Language string
}

type FieldMap

type FieldMap[K string, V any] map[K]V

type Model

type Model struct {
	ID        uint      `gorm:"column:id;primary_key" json:"id"`
	CreatedAt time.Time `gorm:"column:createdAt" json:"createdAt" yaml:"-"`
	UpdatedAt time.Time `gorm:"column:updatedAt" json:"updatedAt" yaml:"-"`

	Disabled bool `gorm:"column:disabled;default:false" json:"disabled" yaml:"-"`
	Deleted  bool `gorm:"column:deleted;default:false" json:"deleted" yaml:"-"`
}

type ReqData

type ReqData struct {
	Action   string      `json:"action"`
	Id       int         `json:"id"`
	DomainId int         `json:"domainId"`
	Mode     string      `json:"mode"`
	Data     interface{} `json:"data"`

	Src  int `json:"src"`
	Dist int `json:"dist"`

	Keywords string `json:"keywords"`
	Page     int    `json:"page"`
}

type RespData

type RespData struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
	Model   interface{} `json:"model"`
	Res     interface{} `json:"res"`
	WorkDir string      `json:"workDir"`

	Total int `json:"total"`
}

type XmlData

type XmlData struct {
	XMLName xml.Name `xml:"testdata"`
	Title   string   `xml:"title"`
	Table   XmlTable `xml:"table"`
}

type XmlRow

type XmlRow struct {
	XMLName xml.Name          `xml:"row"`
	Cols    map[string]string `xml:"col"`
}

type XmlTable

type XmlTable struct {
	Rows []XmlRow `xml:"row"`
}

type ZdConfig

type ZdConfig struct {
	Model
	Title string `gorm:"column:title" json:"title"`
	Desc  string `gorm:"column:desc" json:"desc"`

	Range   string `gorm:"column:range" json:"range"`
	Prefix  string `gorm:"column:prefix" json:"prefix"`
	Postfix string `gorm:"column:postfix" json:"postfix"`
	Loop    string `gorm:"column:loop" json:"loop"`
	Loopfix string `gorm:"column:loopfix" json:"loopfix"`
	Format  string `gorm:"column:format" json:"format"`

	Yaml      string `gorm:"yaml" json:"yaml"`
	Path      string `gorm:"column:path" json:"path" yaml:"-"`
	Folder    string `gorm:"folder" json:"folder" yaml:"-"`
	FileName  string `gorm:"column:fileName" json:"fileName" yaml:"-"`
	ReferName string `gorm:"column:referName" json:"referName" yaml:"-"`

	// for range edit
	IsRange  bool        `gorm:"column:isRange;default:true" json:"isRange" yaml:"-"`
	Sections []ZdSection `gorm:"ForeignKey:ownerID" json:"sections" yaml:"-"`
}

func (*ZdConfig) TableName

func (*ZdConfig) TableName() string

type ZdDef

type ZdDef struct {
	Model
	Title string `gorm:"column:title" json:"title"`
	Type  string `gorm:"column:type" json:"type"`
	Desc  string `gorm:"column:desc" json:"desc"`

	Yaml     string `gorm:"yaml" json:"yaml"`
	Path     string `gorm:"column:path" json:"path" yaml:"-"`
	Folder   string `gorm:"column:folder" json:"folder" yaml:"-"`
	FileName string `gorm:"column:fileName" json:"fileName" yaml:"-"`
	IsMock   bool   `gorm:"column:isMock" json:"isMock"`

	ReferName string    `gorm:"column:referName" json:"referName" yaml:"-"`
	From      string    `gorm:"-" json:"from"`
	Fields    []ZdField `gorm:"-" json:"fields"`
}

func (*ZdDef) TableName

func (*ZdDef) TableName() string

type ZdExcel

type ZdExcel struct {
	Model
	Title string `gorm:"column:title" json:"title"`
	Sheet string `gorm:"column:sheet" json:"sheet"`

	ChangeTime string `gorm:"column:changeTime" json:"changeTime"`
	Yaml       string `gorm:"yaml" json:"yaml"`
	Path       string `gorm:"column:path" json:"path" yaml:"-"`
	Folder     string `gorm:"folder" json:"folder" yaml:"-"`
	FileName   string `gorm:"column:fileName" json:"fileName" yaml:"-"`
	ReferName  string `gorm:"column:referName" json:"referName" yaml:"-"`
}

func (*ZdExcel) TableName

func (*ZdExcel) TableName() string

type ZdField

type ZdField struct {
	Model
	Field string `gorm:"column:field" json:"field"`
	Note  string `gorm:"column:note" json:"note"`

	Range    string `gorm:"column:range" json:"range"`
	Prefix   string `gorm:"column:prefix" json:"prefix"`
	Postfix  string `gorm:"column:postfix" json:"postfix"`
	Divider  string `gorm:"column:divider" json:"divider"`
	Loop     string `gorm:"column:loop" json:"loop"`
	Loopfix  string `gorm:"column:loopfix" json:"loopfix"`
	Format   string `gorm:"column:format" json:"format"`
	Type     string `gorm:"column:type" json:"type"`
	Mode     string `gorm:"column:mode" json:"mode"`
	Items    int    `gorm:"column:records" json:"records"`
	Length   int    `gorm:"column:length" json:"length"`
	LeftPad  string `gorm:"column:leftPad" json:"leftPad"`
	RightPad string `gorm:"column:rightPad" json:"rightPad"`
	Rand     bool   `gorm:"column:rand" json:"rand"`
	Config   string `gorm:"column:config" json:"config"`
	Use      string `gorm:"column:use" json:"use"`
	From     string `gorm:"column:fromCol" json:"fromCol"`
	Select   string `gorm:"column:selectCol" json:"selectCol"`
	Where    string `gorm:"column:whereCol" json:"whereCol"`
	Limit    int    `gorm:"column:limitCol" json:"limitCol"`

	// refer to yaml or text by using range prop
	Step   string `gorm:"column:step" json:"step"`
	Repeat string `gorm:"column:repeat" json:"repeat"`

	Exp      string `gorm:"column:exp" json:"exp"`
	DefID    uint   `gorm:"column:defID" json:"defID"`
	ParentID uint   `gorm:"column:parentID" json:"parentID"`
	UseID    uint   `gorm:"column:useID" json:"useID"`
	ConfigID uint   `gorm:"column:configID" json:"configID"`

	Ord  int  `gorm:"column:ord;default:1" json:"ord"`
	Join bool `gorm:"join" json:"join"`

	Fields []*ZdField `gorm:"-" json:"fields"`
	Froms  []*ZdField `gorm:"-" json:"froms"`

	// for range edit
	IsRange  bool        `gorm:"column:isRange;default:true" json:"isRange"`
	Sections []ZdSection `gorm:"ForeignKey:ownerID" json:"sections"`

	// for refer edit
	Refer ZdRefer `gorm:"ForeignKey:ownerID" json:"refer"`

	// generated by range or refer
	GeneratedBy consts.GeneratedBy `gorm:"column:generatedBy;default:range" json:"generatedBy"`
}

func (*ZdField) TableName

func (*ZdField) TableName() string

type ZdInstances

type ZdInstances struct {
	Model `yaml:"-"`
	Title string `gorm:"column:title" json:"title" yaml:"title,omitempty"`
	Desc  string `gorm:"column:desc" json:"desc" yaml:"desc,omitempty"`

	Yaml   string `gorm:"yaml" json:"yaml" yaml:"-"`
	Path   string `gorm:"column:path" json:"path" yaml:"-"`
	Folder string `gorm:"folder" json:"folder" yaml:"-"`

	FileName  string `gorm:"column:fileName" json:"fileName" yaml:"-"`
	ReferName string `gorm:"column:referName" json:"referName" yaml:"-"`

	From      string            `gorm:"-" json:"from"`
	Instances []ZdInstancesItem `gorm:"ForeignKey:instancesID" json:"instances" yaml:"instances"`
}

func (*ZdInstances) TableName

func (*ZdInstances) TableName() string

type ZdInstancesItem

type ZdInstancesItem struct {
	Model `yaml:"-"`

	Instance string `gorm:"column:instance" json:"instance" yaml:"instance,omitempty"`
	Note     string `gorm:"column:note" json:"note" yaml:"note,omitempty"`

	Field    string `gorm:"column:field" json:"field" yaml:"field,omitempty"`
	Range    string `gorm:"column:range" json:"range" yaml:"range,omitempty"`
	Prefix   string `gorm:"column:prefix" json:"prefix" yaml:"prefix,omitempty"`
	Postfix  string `gorm:"column:postfix" json:"postfix" yaml:"postfix,omitempty"`
	Loop     string `gorm:"column:loop" json:"loop" yaml:"loop,omitempty"`
	Loopfix  string `gorm:"column:loopfix" json:"loopfix" yaml:"loopfix,omitempty"`
	Format   string `gorm:"column:format" json:"format" yaml:"format,omitempty"`
	Type     string `gorm:"column:type" json:"type" yaml:"type,omitempty"`
	Mode     string `gorm:"column:mode" json:"mode" yaml:"mode,omitempty"`
	Items    int    `gorm:"column:records" json:"records,omitempty" yaml:"records,omitempty"`
	Length   int    `gorm:"column:length" json:"length" yaml:"length,omitempty"`
	LeftPad  string `gorm:"column:leftPad" json:"leftPad" yaml:"leftPad,omitempty"`
	RightPad string `gorm:"column:rightPad" json:"rightPad" yaml:"rightPad,omitempty"`
	Rand     bool   `gorm:"column:rand" json:"rand" yaml:"rand,omitempty"`

	Config string `gorm:"column:config" json:"config" yaml:"config,omitempty"`
	Use    string `gorm:"column:use" json:"use" yaml:"use,omitempty"`
	From   string `gorm:"column:fromCol" json:"fromCol" yaml:"from,omitempty"`
	Select string `gorm:"column:selectCol" json:"selectCol" yaml:"select,omitempty"`
	Where  string `gorm:"column:whereCol" json:"whereCol" yaml:"where,omitempty"`
	Limit  int    `gorm:"column:limitCol" json:"limitCol" yaml:"limit,omitempty"`

	Exp         string `gorm:"column:exp" json:"exp" yaml:"exp,omitempty"`
	InstancesID uint   `gorm:"column:instancesID" json:"instancesID" yaml:"-"`
	ParentID    uint   `gorm:"column:parentID" json:"parentID" yaml:"-"`
	ConfigID    uint   `gorm:"column:configID" json:"configID" yaml:"-"`
	UseID       uint   `gorm:"column:useID" json:"useID" yaml:"-"`

	Ord    int                `gorm:"column:ord;default:1" json:"ord" yaml:"-"`
	Fields []*ZdInstancesItem `gorm:"-" json:"fields" yaml:"fields,omitempty"`
	Froms  []*ZdInstancesItem `gorm:"-" json:"froms" yaml:"froms,omitempty"`

	// for range edit
	IsRange  bool        `gorm:"column:isRange;default:true" json:"isRange" yaml:"-"`
	Sections []ZdSection `gorm:"ForeignKey:ownerID" json:"sections" yaml:"-"`

	// for refer edit
	Refer ZdRefer `gorm:"ForeignKey:ownerID" json:"refer" yaml:"-"`
}

func (*ZdInstancesItem) TableName

func (*ZdInstancesItem) TableName() string

type ZdMock

type ZdMock struct {
	Model
	Name  string `json:"name"`
	Path  string `json:"path"`
	Desc  string `json:"desc"`
	DefId uint   `json:"defId"`

	SpecContent string `json:"specContent"`
	MockContent string `json:"mockContent"`
	DataContent string `json:"dataContent"`
	DataPath    string `json:"dataPath"`
}

func (*ZdMock) TableName

func (*ZdMock) TableName() string

type ZdMockSampleSrc

type ZdMockSampleSrc struct {
	Model
	MockId uint   `json:"mockId"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

func (*ZdMockSampleSrc) TableName

func (*ZdMockSampleSrc) TableName() string

type ZdRanges

type ZdRanges struct {
	Model
	Title   string `gorm:"column:title" json:"title"`
	Desc    string `gorm:"column:desc" json:"desc"`
	Prefix  string `gorm:"column:prefix" json:"prefix"`
	Postfix string `gorm:"column:postfix" json:"postfix"`
	Format  string `gorm:"column:format" json:"format"`

	Yaml      string `gorm:"yaml" json:"yaml"`
	Path      string `gorm:"column:path" json:"path" yaml:"-"`
	Folder    string `gorm:"folder" json:"folder" yaml:"-"`
	FileName  string `gorm:"column:fileName" json:"fileName" yaml:"-"`
	ReferName string `gorm:"column:referName" json:"referName" yaml:"-"`

	Ranges   []ZdRangesItem    `gorm:"ForeignKey:rangesID" json:"ranges" yaml:"-"`
	RangeMap map[string]string `gorm:"-" yaml:"ranges"`
}

func (*ZdRanges) TableName

func (*ZdRanges) TableName() string

type ZdRangesItem

type ZdRangesItem struct {
	Model
	RangesID uint   `gorm:"column:rangesID" json:"rangesID"`
	Field    string `gorm:"column:name" json:"field"`
	Ord      int    `gorm:"column:ord" json:"ord"`

	Value    string      `gorm:"column:value" json:"value"`
	Sections []ZdSection `gorm:"ForeignKey:ownerID" json:"sections"`

	// for tree node
	ParentID uint            `gorm:"-" json:"parentID"`
	Fields   []*ZdRangesItem `gorm:"-" json:"fields"`
}

func (*ZdRangesItem) TableName

func (*ZdRangesItem) TableName() string

type ZdRefer

type ZdRefer struct {
	Model
	OwnerType string `gorm:"column:ownerType" json:"ownerType"` // field or instances
	OwnerID   uint   `gorm:"column:ownerID" json:"ownerID"`
	Type      string `gorm:"column:type" json:"type"`

	Value string `gorm:"column:value" json:"value"`
	File  string `gorm:"column:file" json:"file"`
	Sheet string `gorm:"column:sheet" json:"sheet"`

	ColName   string `gorm:"column:colName" json:"colName"`
	ColIndex  int    `gorm:"column:colIndex" json:"colIndex"`
	Condition string `gorm:"column:condition" json:"condition"`
	Count     int    `gorm:"column:count" json:"count"`
	CountTag  string `gorm:"column:countTag" json:"countTag"`
	Step      int    `gorm:"column:step" json:"step"`
	Rand      bool   `gorm:"column:rand" json:"rand"`
	HasTitle  bool   `gorm:"column:hasTitle" json:"hasTitle"`
}

func (*ZdRefer) TableName

func (*ZdRefer) TableName() string

type ZdSection

type ZdSection struct {
	Model
	OwnerType string `gorm:"column:ownerType" json:"ownerType"` // field or instances
	OwnerID   uint   `gorm:"column:ownerID" json:"ownerID"`
	Type      string `gorm:"column:type;default:interval" json:"type"`
	Value     string `gorm:"column:value" json:"value"`
	Ord       int    `gorm:"column:ord;default:1" json:"ord"`

	// for range
	Start     string `gorm:"column:start" json:"start"`
	End       string `gorm:"column:end" json:"end"`
	Step      int    `gorm:"column:step;default:1" json:"step"`
	Repeat    string `gorm:"column:repeat;default:1" json:"repeat"`
	RepeatTag string `gorm:"column:repeatTag" json:"repeatTag"`
	Rand      bool   `gorm:"column:rand;default:false" json:"rand"`

	// for arr and const
	Text string `gorm:"-" json:"-"`
}

func (*ZdSection) TableName

func (*ZdSection) TableName() string

type ZdText

type ZdText struct {
	Model
	Title string `gorm:"column:title" json:"title"`

	Content   string `gorm:"column:content" json:"content"`
	Path      string `gorm:"column:path" json:"path" yaml:"-"`
	Folder    string `gorm:"folder" json:"folder" yaml:"-"`
	FileName  string `gorm:"column:fileName" json:"fileName" yaml:"-"`
	ReferName string `gorm:"column:referName" json:"referName" yaml:"-"`
}

func (*ZdText) TableName

func (*ZdText) TableName() string

Jump to

Keyboard shortcuts

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