Documentation ¶
Index ¶
- func CreateCollection(dBResource *crud.Resource, c *gin.Context)
- func FindOneCollection(dBResource *crud.Resource, name string) *map[string]*CollectionField
- func GetCollection(dBResource *crud.Resource, c *gin.Context)
- func QueryCollection(dBResource *crud.Resource, c *gin.Context)
- type Collection
- type CollectionField
- func (field *CollectionField) GetCustomSelectOption(value string, customValue string) string
- func (field *CollectionField) GetCustomSelectOptions(savedValues interface{}, customValues interface{}) []string
- func (field *CollectionField) GetSelectOption(value string) string
- func (field *CollectionField) GetSelectOptions(value interface{}) []string
- type CollectionRequest
- type Developer
- type Function
- type SelectOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindOneCollection ¶ added in v1.0.21
func FindOneCollection(dBResource *crud.Resource, name string) *map[string]*CollectionField
查看集合
Types ¶
type Collection ¶
type Collection struct { base.BaseId `bson,inline` Name string `bson:"name,omitempty" json:"name,omitempty" update:"setOnInsert"` Description string `bson:"description,omitempty" json:"description,omitempty"` Version int64 `bson:"version,omitempty" json:"version,omitempty"` Extend string `bson:"extend,omitempty" json:"extend,omitempty"` Owner string `bson:"owner,omitempty" json:"owner,omitempty"` Fields []CollectionField `bson:"fields,omitempty" json:"fields,omitempty"` Developers []Developer `bson:"developers,omitempty" json:"developers,omitempty"` Functions map[string]Function `bson:"functions,omitempty" json:"functions,omitempty"` }
集合
func (*Collection) GetCollectionName ¶
func (collection *Collection) GetCollectionName() *string
type CollectionField ¶
type CollectionField struct { // 字段名称 Name string `bson:"name" json:"name,omitempty"` // 字段中文名称 Title string `bson:"title" json:"title,omitempty"` // 字段类型 Type string `bson:"type" json:"type"` // 字段描述 Desc string `bson:"desc,omitempty" json:"desc,omitempty"` RefField bool `bson:"refField,omitempty" json:"refField,omitempty"` SetOnInsert bool `bson:"setOnInsert,omitempty" json:"setOnInsert,omitempty"` // 如果是内置对象模型,具体的字段是定义 Fields []CollectionField `bson:"fields,omitempty" json:"fields,omitempty"` SelectOptions []SelectOptions `bson:"selectOptions,omitempty" json:"selectOptions,omitempty"` // 值 Value interface{} `bson:"value,omitempty" json:"value,omitempty"` // 默认值 DefaultValue interface{} `bson:"defaultValue,omitempty" json:"defaultValue,omitempty"` // 验证规则 Validate string `bson:"validate,omitempty" json:"validate,omitempty"` // id 初始化值 IdInitVal int64 `bson:"idInitVal,omitempty" json:"idInitVal,omitempty"` // id key IdKey string `bson:"idKey,omitempty" json:"idKey,omitempty"` }
集合字段类型
func (*CollectionField) GetCustomSelectOption ¶ added in v1.0.39
func (field *CollectionField) GetCustomSelectOption(value string, customValue string) string
有些时候,选项是其他并且自定义输入的情况,那么就判断一下显示自定义值
func (*CollectionField) GetCustomSelectOptions ¶ added in v1.0.39
func (field *CollectionField) GetCustomSelectOptions(savedValues interface{}, customValues interface{}) []string
有些时候,选项是其他并且自定义输入的情况,那么就判断一下显示自定义值
func (*CollectionField) GetSelectOption ¶ added in v1.0.38
func (field *CollectionField) GetSelectOption(value string) string
根据 option的值选择 option 的label
func (*CollectionField) GetSelectOptions ¶ added in v1.0.39
func (field *CollectionField) GetSelectOptions(value interface{}) []string
根据 option的值选择 option 的label,多选场景
type CollectionRequest ¶
type CollectionRequest struct { commons.PagingRequest Name string `bson:"name,omitempty" json:"name,omitempty" update:"setOnInsert"` }
type Developer ¶
type Developer struct { Name string `bson:"name,omitempty" json:"name,omitempty"` Time string `bson:"time,omitempty" json:"time,omitempty"` Desc string `bson:"desc,omitempty" json:"desc,omitempty"` }
开发者
type Function ¶
type Function struct { Params []CollectionField `bson:"params,omitempty" json:"params,omitempty"` Template string `bson:"template,omitempty" json:"template,omitempty"` }
开发者
type SelectOptions ¶
Click to show internal directories.
Click to hide internal directories.