github.com/easysoft/zendata@v0.0.0-20240513203326-705bd5a7fd67/internal/server/model/zd-field.go (about) 1 package model 2 3 import ( 4 consts "github.com/easysoft/zendata/internal/pkg/const" 5 ) 6 7 type ZdField struct { 8 BaseModel 9 10 Field string `json:"field"` 11 Note string `json:"note"` 12 13 Range string `json:"range"` 14 Prefix string `json:"prefix"` 15 Postfix string `json:"postfix"` 16 Divider string `json:"divider"` 17 Loop string `json:"loop"` 18 Loopfix string `json:"loopfix"` 19 Format string `json:"format"` 20 Type string `json:"type"` 21 Mode string `json:"mode"` 22 Items int `json:"records"` 23 Length int `json:"length"` 24 LeftPad string `json:"leftPad"` 25 RightPad string `json:"rightPad"` 26 Rand bool `json:"rand"` 27 Config string `json:"config"` 28 Use string `json:"use"` 29 From string `json:"fromCol"` 30 Select string `json:"selectCol"` 31 Where string `json:"whereCol"` 32 Limit int `json:"limitCol"` 33 34 // refer to yaml or text by using range prop 35 Step string `json:"step"` 36 Repeat string `json:"repeat"` 37 38 Exp string `json:"exp"` 39 DefID uint `json:"defID"` 40 ParentID uint `json:"parentID"` 41 UseID uint `json:"useID"` 42 ConfigID uint `json:"configID"` 43 44 Ord int `gorm:"default:1" json:"ord"` 45 Join bool `json:"join"` 46 47 Fields []*ZdField `gorm:"-" json:"fields"` 48 Froms []*ZdField `gorm:"-" json:"froms"` 49 50 // for range edit 51 IsRange bool `gorm:"default:true" json:"isRange"` 52 Sections []ZdSection `gorm:"ForeignKey:ownerID" json:"sections"` 53 54 // for refer edit 55 Refer ZdRefer `gorm:"ForeignKey:ownerID" json:"refer"` 56 57 // generated by range or refer 58 GeneratedBy consts.GeneratedBy `gorm:"default:range" json:"generatedBy"` 59 } 60 61 func (*ZdField) TableName() string { 62 return consts.TablePrefix + "field" 63 }