models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalTableList = map[string]GlobalTable{

	"manager":    GetManagerTable(),
	"permission": GetPermissionTable(),
	"roles":      GetRolesTable(),
	"op":         GetOpTable(),

	"user": GetUserTable(),
}

map下标是路由前缀,对应的值是GlobalTable类型,为表单与表格的数据抽象表示

Functions

func CheckInTable

func CheckInTable(colums []map[string]interface{}, find string) bool

检查字段是否在数据表中

func GetPaginator

func GetPaginator(path string, pageInt int, page string, pageSize string, size int, prefix string) map[string]interface{}

func GetStringFromType

func GetStringFromType(typeName string, value interface{}) string

func RefreshGlobalTableList

func RefreshGlobalTableList()

Types

type FieldStruct

type FieldStruct struct {
	ExcuFun  FieldValueFun
	Field    string
	TypeName string
	Head     string
}

展示列

func (*FieldStruct) SetField

func (field *FieldStruct) SetField(fieldName string) *FieldStruct

func (*FieldStruct) SetHead

func (field *FieldStruct) SetHead(head string) *FieldStruct

func (*FieldStruct) SetTypeName

func (field *FieldStruct) SetTypeName(typeName string) *FieldStruct

type FieldValueFun

type FieldValueFun func(value RowModel) interface{}

数据过滤函数

type FormPanel

type FormPanel struct {
	FormList    []FormStruct
	Table       string
	Title       string
	Description string
}

表单面板

type FormStruct

type FormStruct struct {
	Field    string
	TypeName string
	Head     string
	Default  string
	Editable bool
	FormType string
	Value    string
	Options  []map[string]string
	ExcuFun  FieldValueFun
}

表单列

type GlobalTable

type GlobalTable struct {
	Info InfoPanel
	Form FormPanel
}

一个管理数据模块的抽象表示

func GetManagerTable

func GetManagerTable() (userTable GlobalTable)

func GetOpTable

func GetOpTable() (userTable GlobalTable)

func GetPermissionTable

func GetPermissionTable() (userTable GlobalTable)

func GetRolesTable

func GetRolesTable() (userTable GlobalTable)

func GetUserTable

func GetUserTable() (userTable GlobalTable)

func (GlobalTable) DeleteDataFromDatabase

func (tableModel GlobalTable) DeleteDataFromDatabase(prefix string, id string)

删数据

func (GlobalTable) GetDataFromDatabase

func (tableModel GlobalTable) GetDataFromDatabase(queryParam map[string]string) ([]string, []map[string]string, map[string]interface{}, string, string)

查数据

func (GlobalTable) GetDataFromDatabaseWithId

func (tableModel GlobalTable) GetDataFromDatabaseWithId(prefix string, id string) ([]FormStruct, string, string)

查单个数据

func (GlobalTable) InsertDataFromDatabase

func (tableModel GlobalTable) InsertDataFromDatabase(prefix string, dataList map[string][]string)

增数据

func (GlobalTable) UpdateDataFromDatabase

func (tableModel GlobalTable) UpdateDataFromDatabase(prefix string, dataList map[string][]string)

改数据

type InfoPanel

type InfoPanel struct {
	FieldList   []FieldStruct
	Table       string
	Title       string
	Description string
}

展示面板

type RowModel

type RowModel struct {
	ID    int64
	Value string
}

Jump to

Keyboard shortcuts

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