model_data_model

package
v0.0.0-...-9e8b3cb Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataModelPermissionALL    = "Model_ALL"
	DataModelPermissionCreate = "Model_CREATE"
	DataModelPermissionSelect = "Model_SELECT"
	DataModelPermissionEdit   = "Model_EDIT"
	DataModelPermissionDelete = "Model_DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Type string `json:"type,omitempty" bson:"type,omitempty"` //数据类型
	Name string `json:"name,omitempty" bson:"name,omitempty"`
	//attribute是数组时,数组内元素对象
	ModelName  string `json:"model_name,omitempty" bson:"model_name,omitempty"`
	ModelId    int64  `json:"model_id,omitempty" bson:"model_id,omitempty"`
	Default    string `json:"default,omitempty" bson:"default,omitempty"`   //默认值
	Required   bool   `json:"required" bson:"required,omitempty"`           //是否必填 RequestPara 使用
	Comments   string `json:"comments,omitempty" bson:"comments,omitempty"` //属性说明
	UpdateTime int64  `json:"update_time,omitempty" bson:"update_time,omitempty"`
}

func (Attribute) ToJson

func (a Attribute) ToJson() string

type DataModel

type DataModel struct {
	Id         int64                   `json:"id,omitempty" bson:"_id,omitempty"`
	Name       string                  `json:"name,omitempty" bson:"name,omitempty"` //过滤中文名
	Alias      string                  `json:"alias,omitempty"  bson:"alias,omitempty"`
	Desc       string                  `json:"desc,omitempty" bson:"desc,omitempty"` //模型说明
	CreateTime int64                   `json:"create_time,omitempty" bson:"create_time,omitempty"`
	Attributes []Attribute             `json:"attributes,omitempty" bson:"attributes,omitempty"` //模型的属性表
	Apps       []model_app.Application `json:"apps,omitempty" bson:"apps,omitempty"`             //不存入数据库
	Owner      model_user.User         `json:"owner,omitempty" bson:"owner,omitempty"`           //模型负责人(初始为创建人)
	ParentId   int64                   `json:"parent_id,omitempty" bson:"parent_id,omitempty"`
	Parent     interface{}             `json:"parent,omitempty" bson:"parent,omitempty"`
}

TODO 历史版本记录

func (DataModel) AddAttribute

func (d DataModel) AddAttribute(a Attribute) error

func (DataModel) AddAttributes

func (d DataModel) AddAttributes(list []Attribute) error

func (DataModel) Exist

func (d DataModel) Exist(query interface{}) bool

func (DataModel) FindOne

func (d DataModel) FindOne(query, selector interface{}) (dm DataModel, err error)

* 查询模型详细信息

func (DataModel) FindPageFilter

func (d DataModel) FindPageFilter(page, limit int, query, selector interface{}, fields ...string) ([]DataModel, error)

func (DataModel) FindSimpleOne

func (d DataModel) FindSimpleOne(query, selector interface{}) (dm DataModel, err error)

func (DataModel) Insert

func (d DataModel) Insert() (id int64, err error)

插入基本信息

func (DataModel) Remove

func (d DataModel) Remove() error

func (DataModel) RemoveAttribute

func (d DataModel) RemoveAttribute(a Attribute) error

func (DataModel) RemoveAttributes

func (d DataModel) RemoveAttributes(list []Attribute) error

func (DataModel) ToJson

func (d DataModel) ToJson() string

func (DataModel) TotalCount

func (d DataModel) TotalCount(query, selector interface{}) (int, error)

func (DataModel) Update

func (d DataModel) Update() error

func (DataModel) UpdateAppRelation

func (d DataModel) UpdateAppRelation() error

Jump to

Keyboard shortcuts

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