Documentation
¶
Index ¶
- Constants
- Variables
- func ApiCount(ctx *gin.Context)
- func ApiCreate(ctx *gin.Context)
- func ApiDelete(ctx *gin.Context)
- func ApiDetail(ctx *gin.Context)
- func ApiExport(ctx *gin.Context)
- func ApiImport(ctx *gin.Context)
- func ApiSearch(ctx *gin.Context)
- func ApiTableCreate(ctx *gin.Context)
- func ApiTableList(ctx *gin.Context)
- func ApiTableReload(ctx *gin.Context)
- func ApiTableRemove(ctx *gin.Context)
- func ApiTableRename(ctx *gin.Context)
- func ApiUpdate(ctx *gin.Context)
- func Error(ctx *gin.Context, err error)
- func Fail(ctx *gin.Context, err string)
- func FormFiles(ctx *gin.Context) (files []*multipart.FileHeader, err error)
- func List(ctx *gin.Context, data any, total int64)
- func Load(path string) error
- func OK(ctx *gin.Context, data any)
- func Register(table *Table)
- func RemoveHookValues(name string)
- func Scan(dir string) error
- func SetHookValues(name string, value any)
- func Startup() error
- func Sync(tables []*Table) error
- func TypeToSqlType(t string) (st schemas.SQLType)
- type Document
- type Field
- type Hook
- type HookScripts
- type ReplyData
- type ReplyList
- type Table
- func (t *Table) Count(filter map[string]any) (cnt int64, err error)
- func (t *Table) Create() error
- func (t *Table) Delete(filter map[string]any) (rows int64, err error)
- func (t *Table) DeleteById(id any) (rows int64, err error)
- func (t *Table) Drop() error
- func (t *Table) Field(name string) *Field
- func (t *Table) Find(filter map[string]any, fields []string, skip, limit int) (rows []map[string]any, err error)
- func (t *Table) Get(id any, fields []string) (Document, error)
- func (t *Table) Init() error
- func (t *Table) Insert(values map[string]any) (id any, err error)
- func (t *Table) PrimaryKeys() []*Field
- func (t *Table) Schema() *schemas.Table
- func (t *Table) Update(filter map[string]any, values map[string]any) (rows int64, err error)
- func (t *Table) UpdateById(id any, values map[string]any) (rows int64, err error)
Constants ¶
View Source
const MODULE = "table"
Variables ¶
View Source
var Path = "tables"
Functions ¶
func ApiTableCreate ¶
func ApiTableList ¶
func ApiTableReload ¶
func ApiTableRemove ¶
func ApiTableRename ¶
func RemoveHookValues ¶ added in v0.6.0
func RemoveHookValues(name string)
func SetHookValues ¶ added in v0.6.0
func TypeToSqlType ¶
Types ¶
type Field ¶
type Field struct {
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Type string `json:"type,omitempty"`
Default string `json:"default,omitempty"`
NotNull bool `json:"not_null,omitempty"`
Length int64 `json:"length,omitempty"`
Length2 int64 `json:"length2,omitempty"`
PrimaryKey bool `json:"primary_key,omitempty"`
Increment bool `json:"increment,omitempty"`
Indexed bool `json:"indexed,omitempty"`
Created bool `json:"created,omitempty"`
Updated bool `json:"updated,omitempty"`
Json bool `json:"json,omitempty"`
}
type Hook ¶ added in v0.6.0
type Hook struct {
BeforeInsert func(doc Document) error
AfterInsert func(id any, doc Document) error
BeforeUpdate func(id any, update Document) error
AfterUpdate func(id any, update Document, base Document) error
BeforeDelete func(id any) error
AfterDelete func(id any, doc Document) error
Scripts *HookScripts `json:"scripts,omitempty"`
}
type HookScripts ¶ added in v0.6.0
type HookScripts struct {
BeforeInsert string `json:"before_insert,omitempty"`
AfterInsert string `json:"after_insert,omitempty"`
BeforeUpdate string `json:"before_update,omitempty"`
AfterUpdate string `json:"after_update,omitempty"`
BeforeDelete string `json:"before_delete,omitempty"`
AfterDelete string `json:"after_delete,omitempty"`
}
type Table ¶
type Table struct {
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Fields []*Field `json:"fields,omitempty"`
DisableInsert bool `json:"disable_insert,omitempty"`
DisableUpdate bool `json:"disable_update,omitempty"`
DisableDelete bool `json:"disable_delete,omitempty"`
//原生钩子
Hook
// contains filtered or unexported fields
}
func (*Table) PrimaryKeys ¶ added in v0.6.0
Click to show internal directories.
Click to hide internal directories.