Documentation
¶
Index ¶
- Constants
- type AdminAccessCheck
- type AdminAction
- type AdminActionHandler
- type AdminAttribute
- type AdminBuildContext
- type AdminField
- type AdminForeign
- type AdminIcon
- type AdminObject
- type AdminQueryResult
- type AdminScript
- type AdminSelectOption
- type AdminValue
- type BeforeCreateFunc
- type BeforeDeleteFunc
- type BeforeQueryRenderFunc
- type BeforeRenderFunc
- type BeforeUpdateFunc
- type ContentIcon
- type Filter
- type GetDB
- type Order
- type PrepareQuery
- type QueryForm
- type QueryResult
- type QueryView
- type UploadResult
- type WebObject
- type WebObjectPrimaryField
Constants ¶
View Source
const ( FilterOpIsNot = "is not" FilterOpEqual = "=" FilterOpNotEqual = "<>" FilterOpIn = "in" FilterOpNotIn = "not_in" FilterOpGreater = ">" FilterOpGreaterOrEqual = ">=" FilterOpLess = "<" FilterOpLessOrEqual = "<=" FilterOpLike = "like" FilterOpBetween = "between" )
View Source
const ( OrderOpDesc = "desc" OrderOpAsc = "asc" )
View Source
const ( GET = 1 << 1 CREATE = 1 << 2 EDIT = 1 << 3 DELETE = 1 << 4 QUERY = 1 << 5 )
View Source
const (
DefaultQueryLimit = 102400 // 100k
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminAccessCheck ¶
type AdminAccessCheck func(c *fiber.Ctx, obj *AdminObject) error
Access control
type AdminAction ¶
type AdminAttribute ¶
type AdminAttribute struct {
Default any `json:"default,omitempty"`
Choices []AdminSelectOption `json:"choices,omitempty"`
SingleChoice bool `json:"singleChoice,omitempty"`
Widget string `json:"widget,omitempty"`
FilterWidget string `json:"filterWidget,omitempty"`
Help string `json:"help,omitempty"`
}
type AdminField ¶
type AdminField struct {
Placeholder string `json:"placeholder,omitempty"` // Placeholder of the filed
Label string `json:"label"` // Label of the filed
NotColumn bool `json:"notColumn,omitempty"` // Not a column
Required bool `json:"required,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Tag string `json:"tag,omitempty"`
Attribute *AdminAttribute `json:"attribute,omitempty"`
CanNull bool `json:"canNull,omitempty"`
IsArray bool `json:"isArray,omitempty"`
Primary bool `json:"primary,omitempty"`
Foreign *AdminForeign `json:"foreign,omitempty"`
IsAutoID bool `json:"isAutoId,omitempty"`
IsPtr bool `json:"isPtr,omitempty"`
ElemType reflect.Type `json:"-"`
FieldName string `json:"-"`
}
type AdminForeign ¶
type AdminObject ¶
type AdminObject struct {
Model any `json:"-"`
Group string `json:"group"` // Group name
Name string `json:"name"` // Name of the object
Desc string `json:"desc,omitempty"` // Description
Path string `json:"path"` // Path prefix
Shows []string `json:"shows"` // Show fields
Orders []Order `json:"orders"` // Default orders of the object
Editables []string `json:"editables"` // Editable fields
Filterables []string `json:"filterables"` // Filterable fields
Orderables []string `json:"orderables"` // Orderable fields, can override Orders
Searchables []string `json:"searchables"` // Searchable fields
Requireds []string `json:"requireds,omitempty"` // Required fields
PrimaryKeys []string `json:"primaryKeys"` // Primary keys name
UniqueKeys []string `json:"uniqueKeys"` // Primary keys name
PluralName string `json:"pluralName"`
Fields []AdminField `json:"fields"`
EditPage string `json:"editpage,omitempty"`
ListPage string `json:"listpage,omitempty"`
Scripts []AdminScript `json:"scripts,omitempty"`
Styles []string `json:"styles,omitempty"`
Permissions map[string]bool `json:"permissions,omitempty"`
Actions []AdminAction `json:"actions,omitempty"`
Icon *AdminIcon `json:"icon,omitempty"`
Invisible bool `json:"invisible,omitempty"`
Attributes map[string]AdminAttribute `json:"-"` // Field's extra attributes
AccessCheck AdminAccessCheck `json:"-"` // Access control function
GetDB GetDB `json:"-"`
BeforeCreate BeforeCreateFunc `json:"-"`
BeforeRender BeforeRenderFunc `json:"-"`
BeforeUpdate BeforeUpdateFunc `json:"-"`
BeforeDelete BeforeDeleteFunc `json:"-"`
TableName string `json:"-"`
ModelElem reflect.Type `json:"-"`
Ignores map[string]bool `json:"-"`
PrimaryKeyMaping map[string]string `json:"-"`
MarkDeletedField string `json:"-"`
Weight int `json:"-"`
}
type AdminQueryResult ¶
type AdminScript ¶
type AdminSelectOption ¶
type AdminValue ¶
type BeforeQueryRenderFunc ¶
type BeforeQueryRenderFunc func(ctx *fiber.Ctx, r *QueryResult) (any, error)
type BeforeUpdateFunc ¶
type ContentIcon ¶
type ContentIcon AdminIcon
func (*ContentIcon) Scan ¶
func (s *ContentIcon) Scan(input interface{}) error
type Filter ¶
type QueryForm ¶
type QueryForm struct {
Pos int `json:"pos"`
Limit int `json:"limit"`
Keyword string `json:"keyword,omitempty"`
Filters []Filter `json:"filters,omitempty"`
Orders []Order `json:"orders,omitempty"`
ForeignMode bool `json:"foreign"` // for foreign key
ViewFields []string `json:"-"` // for view
SearchFields []string `json:"-"` // for keyword
}
type QueryResult ¶
type QueryView ¶
type QueryView struct {
Path string `json:"path"`
Method string `json:"method"`
Desc string `json:"desc"`
Prepare PrepareQuery
}
type UploadResult ¶
type UploadResult struct {
PublicUrl string `json:"publicUrl"`
Thumbnail string `json:"thumbnail"`
Path string `json:"path"`
Name string `json:"name"`
External bool `json:"external"`
StorePath string `json:"storePath"`
Dimensions string `json:"dimensions"`
Ext string `json:"ext"`
Size int64 `json:"size"`
ContentType string `json:"contentType"`
}
type WebObject ¶
type WebObject struct {
Model any
Group string
Name string
Desc string
AuthRequired bool
Editables []string
Filterables []string
Orderables []string
Searchables []string
GetDB GetDB
BeforeCreate BeforeCreateFunc
BeforeUpdate BeforeUpdateFunc
BeforeDelete BeforeDeleteFunc
BeforeRender BeforeRenderFunc
BeforeQueryRender BeforeQueryRenderFunc
Views []QueryView
AllowMethods int
PrimaryKeys []WebObjectPrimaryField
UniqueKeys []WebObjectPrimaryField
TableName string
// Model type
ModelElem reflect.Type
// Map json tag to struct field name. such as:
// UUID string `json:"id"` => {"id" : "UUID"}
JsonToFields map[string]string
// Map json tag to field kind. such as:
// UUID string `json:"id"` => {"id": string}
JsonToKinds map[string]reflect.Kind
}
Click to show internal directories.
Click to hide internal directories.