table

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Tables the loaded table widgets

Functions

func Export

func Export() error

Export process & api

func Guard

func Guard(c *gin.Context)

Guard table widget guard

func Load

func Load(cfg config.Config) error

Load load table dsl

func LoadAndExport

func LoadAndExport(cfg config.Config) error

LoadAndExport load table

func LoadFile added in v0.10.3

func LoadFile(root string, file string) error

LoadFile load table dsl by file

func LoadFileSync added in v0.10.3

func LoadFileSync(root string, file string) error

LoadFileSync load table dsl by file

func LoadID

func LoadID(id string, root string) error

LoadID load table dsl by id

Types

type ActionDSL

type ActionDSL struct {
	Guard             string          `json:"guard,omitempty"` // the default guard
	Bind              *BindActionDSL  `json:"bind,omitempty"`
	Setting           *action.Process `json:"setting,omitempty"`
	Component         *action.Process `json:"component,omitempty"`
	Upload            *action.Process `json:"upload,omitempty"`
	Download          *action.Process `json:"download,omitempty"`
	Search            *action.Process `json:"search,omitempty"`
	Get               *action.Process `json:"get,omitempty"`
	Find              *action.Process `json:"find,omitempty"`
	Save              *action.Process `json:"save,omitempty"`
	Create            *action.Process `json:"create,omitempty"`
	Insert            *action.Process `json:"insert,omitempty"`
	Delete            *action.Process `json:"delete,omitempty"`
	DeleteIn          *action.Process `json:"delete-in,omitempty"`
	DeleteWhere       *action.Process `json:"delete-where,omitempty"`
	Update            *action.Process `json:"update,omitempty"`
	UpdateIn          *action.Process `json:"update-in,omitempty"`
	UpdateWhere       *action.Process `json:"update-where,omitempty"`
	BeforeFind        *hook.Before    `json:"before:find,omitempty"`
	AfterFind         *hook.After     `json:"after:find,omitempty"`
	BeforeSearch      *hook.Before    `json:"before:search,omitempty"`
	AfterSearch       *hook.After     `json:"after:search,omitempty"`
	BeforeGet         *hook.Before    `json:"before:get,omitempty"`
	AfterGet          *hook.After     `json:"after:get,omitempty"`
	BeforeSave        *hook.Before    `json:"before:save,omitempty"`
	AfterSave         *hook.After     `json:"after:save,omitempty"`
	BeforeCreate      *hook.Before    `json:"before:create,omitempty"`
	AfterCreate       *hook.After     `json:"after:create,omitempty"`
	BeforeInsert      *hook.Before    `json:"before:insert,omitempty"`
	AfterInsert       *hook.After     `json:"after:insert,omitempty"`
	BeforeDelete      *hook.Before    `json:"before:delete,omitempty"`
	AfterDelete       *hook.After     `json:"after:delete,omitempty"`
	BeforeDeleteIn    *hook.Before    `json:"before:delete-in,omitempty"`
	AfterDeleteIn     *hook.After     `json:"after:delete-in,omitempty"`
	BeforeDeleteWhere *hook.Before    `json:"before:delete-where,omitempty"`
	AfterDeleteWhere  *hook.After     `json:"after:delete-where,omitempty"`
	BeforeUpdate      *hook.Before    `json:"before:update,omitempty"`
	AfterUpdate       *hook.After     `json:"after:update,omitempty"`
	BeforeUpdateIn    *hook.Before    `json:"before:update-in,omitempty"`
	AfterUpdateIn     *hook.After     `json:"after:update-in,omitempty"`
	BeforeUpdateWhere *hook.Before    `json:"before:update-where,omitempty"`
	AfterUpdateWhere  *hook.After     `json:"after:update-where,omitempty"`
}

ActionDSL the table action DSL

func (*ActionDSL) BindModel

func (act *ActionDSL) BindModel(m *model.Model) error

BindModel bind model

func (*ActionDSL) BindTable

func (act *ActionDSL) BindTable(tab *DSL) error

BindTable bind table

func (*ActionDSL) SetDefaultProcess

func (act *ActionDSL) SetDefaultProcess()

SetDefaultProcess set the default value of action

type BatchPresetDSL

type BatchPresetDSL struct {
	Columns   []component.InstanceDSL `json:"columns,omitempty"`
	Deletable bool                    `json:"deletable,omitempty"`
}

BatchPresetDSL layout.header.preset.batch

type BindActionDSL

type BindActionDSL struct {
	Model  string                 `json:"model,omitempty"`  // bind model
	Store  string                 `json:"store,omitempty"`  // bind store
	Table  string                 `json:"table,omitempty"`  // bind table
	Form   string                 `json:"form,omitempty"`   // bind form
	Option map[string]interface{} `json:"option,omitempty"` // bind option
}

BindActionDSL action.bind

type DSL

type DSL struct {
	Root   string                 `json:"-"`
	ID     string                 `json:"id,omitempty"`
	Name   string                 `json:"name,omitempty"`
	Action *ActionDSL             `json:"action"`
	Layout *LayoutDSL             `json:"layout"`
	Fields *FieldsDSL             `json:"fields"`
	Config map[string]interface{} `json:"config,omitempty"`
	CProps field.CloudProps       `json:"-"`
	compute.Computable
	*mapping.Mapping
}

DSL the table DSL

func Get

func Get(table interface{}) (*DSL, error)

Get table via process or id

func MustGet

func MustGet(table interface{}) *DSL

MustGet Get table via process or id thow error

func New

func New(id string) *DSL

New create a new DSL

func (*DSL) Actions added in v0.10.3

func (dsl *DSL) Actions() []component.ActionsExport

Actions get the table actions

func (*DSL) Bind

func (dsl *DSL) Bind() error

Bind model / store / table / ...

func (*DSL) Export

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

Export Export query result to Excel

func (*DSL) Validate

func (dsl *DSL) Validate() error

Validate table

func (*DSL) Xgen

func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (map[string]interface{}, error)

Xgen trans to xgen setting

type FieldsDSL

type FieldsDSL struct {
	Filter field.Filters `json:"filter,omitempty"`
	Table  field.Columns `json:"table,omitempty"`
	// contains filtered or unexported fields
}

FieldsDSL the table fields DSL

func (*FieldsDSL) BindModel

func (fields *FieldsDSL) BindModel(m *model.Model) error

BindModel cast model to fields

func (*FieldsDSL) BindTable

func (fields *FieldsDSL) BindTable(tab *DSL) error

BindTable bind table

func (*FieldsDSL) TableMap

func (fields *FieldsDSL) TableMap() map[string]field.ColumnDSL

TableMap get table maps

func (*FieldsDSL) Xgen

func (fields *FieldsDSL) Xgen(layout *LayoutDSL) (map[string]interface{}, error)

Xgen trans to xgen setting

type FilterLayoutDSL

type FilterLayoutDSL struct {
	Actions component.Actions   `json:"actions,omitempty"`
	Columns component.Instances `json:"columns,omitempty"`
}

FilterLayoutDSL layout.filter

type HeaderLayoutDSL

type HeaderLayoutDSL struct {
	Preset  *PresetHeaderDSL      `json:"preset,omitempty"`
	Actions []component.ActionDSL `json:"actions"`
}

HeaderLayoutDSL layout.header

type ImportPresetDSL

type ImportPresetDSL struct {
	Name    string            `json:"name,omitempty"`
	Actions component.Actions `json:"actions,omitempty"`
}

ImportPresetDSL layout.header.preset.import

type LayoutDSL

type LayoutDSL struct {
	Primary string           `json:"primary,omitempty"`
	Header  *HeaderLayoutDSL `json:"header,omitempty"`
	Filter  *FilterLayoutDSL `json:"filter,omitempty"`
	Table   *ViewLayoutDSL   `json:"table,omitempty"`
}

LayoutDSL the table layout

func (*LayoutDSL) BindModel

func (layout *LayoutDSL) BindModel(m *model.Model, fields *FieldsDSL, option map[string]interface{}) error

BindModel bind model

func (*LayoutDSL) BindTable

func (layout *LayoutDSL) BindTable(tab *DSL, fields *FieldsDSL) error

BindTable bind table

func (*LayoutDSL) Clone added in v0.10.3

func (layout *LayoutDSL) Clone() (*LayoutDSL, error)

Clone layout for output

func (*LayoutDSL) Xgen

func (layout *LayoutDSL) Xgen(data map[string]interface{}, excludes map[string]bool, mapping *mapping.Mapping) (*LayoutDSL, error)

Xgen trans to Xgen setting

type OperationTableDSL

type OperationTableDSL struct {
	Width   int               `json:"width,omitempty"`
	Fold    bool              `json:"fold,omitempty"`
	Hide    bool              `json:"hide,omitempty"`
	Actions component.Actions `json:"actions"`
}

OperationTableDSL layout.table.operation

type PresetHeaderDSL

type PresetHeaderDSL struct {
	Batch  *BatchPresetDSL  `json:"batch,omitempty"`
	Import *ImportPresetDSL `json:"import,omitempty"`
}

PresetHeaderDSL layout.header.preset

type ViewLayoutDSL

type ViewLayoutDSL struct {
	Props     component.PropsDSL  `json:"props,omitempty"`
	Columns   component.Instances `json:"columns,omitempty"`
	Operation OperationTableDSL   `json:"operation,omitempty"`
}

ViewLayoutDSL layout.table

Jump to

Keyboard shortcuts

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