提交 ca3440d2 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix expression issues

上级 6a3d754a
package model
import (
"time"
)
type BaseModel struct {
//gorm.Model
ID uint `gorm:"primary_key" sql:"type:INT(10) UNSIGNED NOT NULL" json:"id"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
Deleted bool `json:"-" gorm:"default:false"`
Disabled bool `json:"disabled,omitempty" gorm:"default:false"`
}
package model
var (
CommonPrefix = "zd_"
Models = []interface{}{
&ZdDef{},
&ZdField{},
&ZdSection{},
&ZdRefer{},
&ZdConfig{},
&ZdRanges{},
&ZdRangesItem{},
&ZdInstances{},
&ZdInstancesItem{},
&ZdText{},
&ZdExcel{},
}
)
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdConfig struct {
BaseModel
Title string `json:"title"`
Desc string `json:"desc"`
Range string `json:"range"`
Prefix string `json:"prefix"`
Postfix string `json:"postfix"`
Loop string `json:"loop"`
Loopfix string `json:"loopfix"`
Format string `json:"format"`
Yaml string `json:"yaml"`
Path string `json:"path" yaml:"-"`
Folder string `json:"folder" yaml:"-"`
FileName string `json:"fileName" yaml:"-"`
ReferName string `json:"referName" yaml:"-"`
// for range edit
IsRange bool `gorm:"default:true" json:"isRange" yaml:"-"`
Sections []ZdSection `gorm:"ForeignKey:ownerID" json:"sections" yaml:"-"`
}
func (*ZdConfig) TableName() string {
return consts.TablePrefix + "config"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdDef struct {
BaseModel
Title string `json:"title"`
Type string `json:"type"`
Desc string `json:"desc"`
Yaml string `json:"yaml"`
Path string `json:"path" yaml:"-"`
Folder string `json:"folder" yaml:"-"`
FileName string `json:"fileName" yaml:"-"`
IsMock bool `json:"isMock"`
ReferName string `json:"referName" yaml:"-"`
From string `json:"from"`
Fields []ZdField `json:"fields"`
}
func (ZdDef) TableName() string {
return consts.TablePrefix + "def"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdExcel struct {
BaseModel
Title string `json:"title"`
Sheet string `json:"sheet"`
ChangeTime string `json:"changeTime"`
Yaml string `json:"yaml"`
Path string `json:"path" yaml:"-"`
Folder string `json:"folder" yaml:"-"`
FileName string `json:"fileName" yaml:"-"`
ReferName string `json:"referName" yaml:"-"`
}
func (*ZdExcel) TableName() string {
return consts.TablePrefix + "excel"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdField struct {
BaseModel
Field string `json:"field"`
Note string `json:"note"`
Range string `json:"range"`
Prefix string `json:"prefix"`
Postfix string `json:"postfix"`
Divider string `json:"divider"`
Loop string `json:"loop"`
Loopfix string `json:"loopfix"`
Format string `json:"format"`
Type string `json:"type"`
Mode string `json:"mode"`
Items int `json:"records"`
Length int `json:"length"`
LeftPad string `json:"leftPad"`
RightPad string `json:"rightPad"`
Rand bool `json:"rand"`
Config string `json:"config"`
Use string `json:"use"`
From string `json:"fromCol"`
Select string `json:"selectCol"`
Where string `json:"whereCol"`
Limit int `json:"limitCol"`
// refer to yaml or text by using range prop
Step string `json:"step"`
Repeat string `json:"repeat"`
Exp string `json:"exp"`
DefID uint `json:"defID"`
ParentID uint `json:"parentID"`
UseID uint `json:"useID"`
ConfigID uint `json:"configID"`
Ord int `gorm:"default:1" json:"ord"`
Join bool `json:"join"`
Fields []*ZdField `gorm:"-" json:"fields"`
Froms []*ZdField `gorm:"-" json:"froms"`
// for range edit
IsRange bool `gorm:"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:"default:range" json:"generatedBy"`
}
func (*ZdField) TableName() string {
return consts.TablePrefix + "field"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdInstancesItem struct {
BaseModel
Instance string `json:"instance" yaml:"instance,omitempty"`
Note string `json:"note" yaml:"note,omitempty"`
Field string `json:"field" yaml:"field,omitempty"`
Range string `json:"range" yaml:"range,omitempty"`
Prefix string `json:"prefix" yaml:"prefix,omitempty"`
Postfix string `json:"postfix" yaml:"postfix,omitempty"`
Loop string `json:"loop" yaml:"loop,omitempty"`
Loopfix string `json:"loopfix" yaml:"loopfix,omitempty"`
Format string `json:"format" yaml:"format,omitempty"`
Type string `json:"type" yaml:"type,omitempty"`
Mode string `json:"mode" yaml:"mode,omitempty"`
Items int `json:"records,omitempty" yaml:"records,omitempty"`
Length int `json:"length" yaml:"length,omitempty"`
LeftPad string `json:"leftPad" yaml:"leftPad,omitempty"`
RightPad string `json:"rightPad" yaml:"rightPad,omitempty"`
Rand bool `json:"rand" yaml:"rand,omitempty"`
Config string `json:"config" yaml:"config,omitempty"`
Use string `json:"use" yaml:"use,omitempty"`
From string `json:"fromCol" yaml:"from,omitempty"`
Select string `json:"selectCol" yaml:"select,omitempty"`
Where string `json:"whereCol" yaml:"where,omitempty"`
Limit int `json:"limitCol" yaml:"limit,omitempty"`
Exp string `json:"exp" yaml:"exp,omitempty"`
InstancesID uint `json:"instancesID" yaml:"-"`
ParentID uint `json:"parentID" yaml:"-"`
ConfigID uint `json:"configID" yaml:"-"`
UseID uint `json:"useID" yaml:"-"`
Ord int `gorm:"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:"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() string {
return consts.TablePrefix + "instances_item"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdInstances struct {
BaseModel
Title string `json:"title" yaml:"title,omitempty"`
Desc string `json:"desc" yaml:"desc,omitempty"`
Yaml string `json:"yaml" yaml:"-"`
Path string `json:"path" yaml:"-"`
Folder string `json:"folder" yaml:"-"`
FileName string `json:"fileName" yaml:"-"`
ReferName string `json:"referName" yaml:"-"`
From string `gorm:"-" json:"from"`
Instances []ZdInstancesItem `gorm:"ForeignKey:instancesID" json:"instances" yaml:"instances"`
}
func (*ZdInstances) TableName() string {
return consts.TablePrefix + "instances"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdRangesItem struct {
BaseModel
RangesID uint `json:"rangesID"`
Field string `json:"field"`
Ord int `json:"ord"`
Value string `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() string {
return consts.TablePrefix + "ranges_item"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdRanges struct {
BaseModel
Title string `json:"title"`
Desc string `json:"desc"`
Prefix string `json:"prefix"`
Postfix string `json:"postfix"`
Format string `json:"format"`
Yaml string `json:"yaml"`
Path string `json:"path" yaml:"-"`
Folder string `json:"folder" yaml:"-"`
FileName string `json:"fileName" yaml:"-"`
ReferName string `json:"referName" yaml:"-"`
Ranges []ZdRangesItem `gorm:"ForeignKey:rangesID" json:"ranges" yaml:"-"`
RangeMap map[string]string `gorm:"-" yaml:"ranges"`
}
func (*ZdRanges) TableName() string {
return consts.TablePrefix + "ranges"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdRefer struct {
BaseModel
OwnerType string `json:"ownerType"` // field or instances
OwnerID uint `json:"ownerID"`
Type string `json:"type"`
Value string `json:"value"`
File string `json:"file"`
Sheet string `json:"sheet"`
ColName string `json:"colName"`
ColIndex int `json:"colIndex"`
Condition string `json:"condition"`
Count int `json:"count"`
CountTag string `json:"countTag"`
Step int `json:"step"`
Rand bool `json:"rand"`
HasTitle bool `json:"hasTitle"`
}
func (*ZdRefer) TableName() string {
return consts.TablePrefix + "refer"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdSection struct {
BaseModel
OwnerType string `json:"ownerType"` // field or instances
OwnerID uint `json:"ownerID"`
Type string `gorm:"default:interval" json:"type"`
Value string `json:"value"`
Ord int `gorm:"default:1" json:"ord"`
// for range
Start string `json:"start"`
End string `json:"end"`
Step int `gorm:"default:1" json:"step"`
Repeat string `gorm:"default:1" json:"repeat"`
RepeatTag string `json:"repeatTag"`
Rand bool `gorm:"default:false" json:"rand"`
// for arr and const
Text string `gorm:"-" json:"-"`
}
func (*ZdSection) TableName() string {
return consts.TablePrefix + "field"
}
package model
import (
consts "github.com/easysoft/zendata/internal/pkg/const"
)
type ZdText struct {
BaseModel
Title string `json:"title"`
Content string `json:"content"`
Path string `json:"path" yaml:"-"`
Folder string `json:"folder" yaml:"-"`
FileName string `json:"fileName" yaml:"-"`
ReferName string `json:"referName" yaml:"-"`
}
func (*ZdText) TableName() string {
return consts.TablePrefix + "text"
}
[
{
"f1": "1, ",
"f2": "101 - 10101"
},
{
"f1": "2, ",
"f2": "102 - 10102"
},
{
"f1": "3, ",
"f2": "103 - 10103"
},
{
"f1": "1, ",
"f2": "101 - 10101"
},
{
"f1": "2, ",
"f2": "102 - 10102"
},
{
"f1": "3, ",
"f2": "103 - 10103"
},
{
"f1": "1, ",
"f2": "101 - 10101"
},
{
"f1": "2, ",
"f2": "102 - 10102"
},
{
"f1": "3, ",
"f2": "103 - 10103"
},
{
"f1": "1, ",
"f2": "101 - 10101"
}
]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册