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: 17 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

func LoadAndExport

func LoadAndExport(cfg config.Config) error

LoadAndExport load table

func LoadData

func LoadData(data []byte, id string, root string) error

LoadData load table from source

func LoadFrom

func LoadFrom(dir string, prefix string) error

LoadFrom load from dir

func LoadID

func LoadID(id string, root string) error

LoadID load by id

Types

type ActionDSL

type ActionDSL struct {
	Bind              *BindActionDSL  `json:"bind,omitempty"`
	Setting           *action.Process `json:"setting,omitempty"`
	Component         *action.Process `json:"component,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 *gou.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
}

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) Bind

func (dsl *DSL) Bind() error

Bind model / store / table / ...

func (*DSL) Parse

func (dsl *DSL) Parse() error

Parse Layout

func (*DSL) Validate

func (dsl *DSL) Validate() error

Validate table

func (*DSL) Xgen

func (dsl *DSL) Xgen() (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 *gou.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"`
	Operation []OperationImportDSL `json:"operation,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 *gou.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) Xgen

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

Xgen trans to Xgen setting

type OperationImportDSL

type OperationImportDSL struct {
	Title string `json:"title,omitempty"`
	Link  string `json:"link,omitempty"`
}

OperationImportDSL layout.header.preset.import.operation[*]

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