table

package
v0.10.2-beta2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tables = map[string]*Table{}

Tables 已载入模型

Functions

func Guard added in v0.9.2

func Guard(c *gin.Context)

Guard Table guard

func Load

func Load(cfg config.Config) error

Load 加载数据表格

func LoadBuildIn

func LoadBuildIn(dir string, prefix string) error

LoadBuildIn 从制品中读取

func LoadFrom

func LoadFrom(dir string, prefix string) error

LoadFrom 从特定目录加载

func ProcessDelete

func ProcessDelete(process *gou.Process) interface{}

ProcessDelete xiang.table.Delete 删除指定主键值的数据记录, 请求成功返回null

func ProcessDeleteIn

func ProcessDeleteIn(process *gou.Process) interface{}

ProcessDeleteIn xiang.table.DeleteIn 按条件批量删除数据, 请求成功返回删除行数

func ProcessDeleteWhere

func ProcessDeleteWhere(process *gou.Process) interface{}

ProcessDeleteWhere xiang.table.DeleteWhere 按条件批量删除数据, 请求成功返回删除行数

func ProcessExport added in v0.9.2

func ProcessExport(process *gou.Process) interface{}

ProcessExport xiang.table.Export (:table, :queryParam, :chunkSize) Export query result to Excel

func ProcessFind

func ProcessFind(process *gou.Process) interface{}

ProcessFind xiang.table.Find 按主键值查询单条数据, 请求成功返回对应主键的数据记录

func ProcessInsert

func ProcessInsert(process *gou.Process) interface{}

ProcessInsert xiang.table.Insert 插入多条数据记录,请求成功返回插入行数

func ProcessQuickSave

func ProcessQuickSave(process *gou.Process) interface{}

ProcessQuickSave xiang.table.QuickSave 保存多条记录。如数据记录中包含主键字段则更新,不包含主键字段则创建记录;返回创建或更新的记录主键值

func ProcessSave

func ProcessSave(process *gou.Process) interface{}

ProcessSave xiang.table.Save 保存单条记录。如数据记录中包含主键字段则更新,不包含主键字段则创建记录;返回创建或更新的记录主键值

func ProcessSearch

func ProcessSearch(process *gou.Process) interface{}

ProcessSearch xiang.table.Search 按条件查询数据记录, 请求成功返回符合查询条件带有分页信息的数据对象

func ProcessSelect

func ProcessSelect(process *gou.Process) interface{}

ProcessSelect xiang.table.Select 单表数据查询,一般用于下拉菜单检索

func ProcessSetting

func ProcessSetting(process *gou.Process) interface{}

ProcessSetting xiang.table.Setting 读取数据表格配置信息, 请求成功返回配置信息对象

func ProcessUpdateIn

func ProcessUpdateIn(process *gou.Process) interface{}

ProcessUpdateIn xiang.table.UpdateWhere 按条件批量更新数据, 请求成功返回更新行数

func ProcessUpdateWhere

func ProcessUpdateWhere(process *gou.Process) interface{}

ProcessUpdateWhere xiang.table.UpdateWhere 按条件批量更新数据, 请求成功返回更新行数

Types

type Bind

type Bind struct {
	Model string              `json:"model"`
	Withs map[string]gou.With `json:"withs,omitempty"`
}

Bind 绑定数据模型

type Hooks

type Hooks struct {
	BeforeFind        string `json:"before:find,omitempty"`
	AfterFind         string `json:"after:find,omitempty"`
	BeforeSearch      string `json:"before:search,omitempty"`
	AfterSearch       string `json:"after:search,omitempty"`
	BeforeSave        string `json:"before:save,omitempty"`
	AfterSave         string `json:"after:save,omitempty"`
	BeforeDelete      string `json:"before:delete,omitempty"`
	AfterDelete       string `json:"after:delete,omitempty"`
	BeforeInsert      string `json:"before:insert,omitempty"`
	AfterInsert       string `json:"after:insert,omitempty"`
	BeforeDeleteIn    string `json:"before:delete-in,omitempty"`
	AfterDeleteIn     string `json:"after:delete-in,omitempty"`
	BeforeDeleteWhere string `json:"before:delete-where,omitempty"`
	AfterDeleteWhere  string `json:"after:delete-where,omitempty"`
	BeforeUpdateIn    string `json:"before:update-in,omitempty"`
	AfterUpdateIn     string `json:"after:update-in,omitempty"`
	BeforeUpdateWhere string `json:"before:update-where,omitempty"`
	AfterUpdateWhere  string `json:"after:update-where,omitempty"`
	BeforeQuicksave   string `json:"before:quicksave,omitempty"`
	AfterQuicksave    string `json:"after:quicksave,omitempty"`
	BeforeSelect      string `json:"before:select,omitempty"`
	AfterSelect       string `json:"after:select,omitempty"`
}

Hooks 表格数据模型

type Table

type Table struct {
	Table      string                  `json:"-"`
	Source     string                  `json:"-"`
	Guard      string                  `json:"guard,omitempty"`
	Name       string                  `json:"name"`
	Version    string                  `json:"version"`
	Title      string                  `json:"title,omitempty"`
	Decription string                  `json:"decription,omitempty"`
	Bind       Bind                    `json:"bind,omitempty"`
	Hooks      Hooks                   `json:"hooks,omitempty"`
	APIs       map[string]share.API    `json:"apis,omitempty"`
	Columns    map[string]share.Column `json:"columns,omitempty"`
	Filters    map[string]share.Filter `json:"filters,omitempty"`
	List       share.Page              `json:"list,omitempty"`
	Edit       share.Page              `json:"edit,omitempty"`
	View       share.Page              `json:"view,omitempty"`
	Insert     share.Page              `json:"insert,omitempty"`
}

Table 数据表格配置结构

func LoadTable

func LoadTable(source string, name string) (*Table, error)

LoadTable 载入数据表格

func Select

func Select(name string) *Table

Select 读取已加载表格配置

func (*Table) After

func (table *Table) After(process string, data interface{}, args []interface{}, sid string) interface{}

After 运行 After hook

func (*Table) Before

func (table *Table) Before(process string, processArgs []interface{}, sid string) []interface{}

Before 运行 Before hook

func (*Table) Export added in v0.9.2

func (table *Table) Export(filename string, data interface{}, page int, chunkSize int) error

Export Export query result to Excel

func (*Table) Lang added in v0.10.1

func (table *Table) Lang(trans func(widget string, inst string, value *string) bool)

Lang for applying a language pack

func (*Table) Reload

func (table *Table) Reload() (*Table, error)

Reload 更新数据表格配置

func (Table) Validate added in v0.10.1

func (table Table) Validate() error

Validate 校验表格格式

Jump to

Keyboard shortcuts

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