Documentation ¶
Index ¶
- func BuildPermActions(values []string) string
- func HandleBatchCheck(ctx echo.Context, config *echo.KVData, current string, rules map[string]string) (mp map[string]interface{}, err error)
- func HandleCheck(ctx echo.Context, config *echo.KVData, current string, typ string, ...) (interface{}, error)
- func HandleFireRender(ctx echo.Context, config *echo.KVData) (err error)
- func HandleGenerate(ctx echo.Context, config *echo.KVData) (mp map[string]string, err error)
- func JSONBytesParseError(err error, jsonBytes []byte) error
- func SerializeBehaviorValues(permBehaviors map[string][]string, behaviors *Behaviors) (string, error)
- type Behavior
- func (b *Behavior) AsString(value interface{}) string
- func (b Behavior) IsValid() bool
- func (b *Behavior) SetFormHelpBlock(helpBlock interface{})
- func (b *Behavior) SetFormValueDecoder(parser func([]string) (interface{}, error))
- func (b *Behavior) SetFormValueEncoder(encoder func(interface{}) (string, error))
- func (b *Behavior) SetValueInitor(initor func() interface{})
- func (b *Behavior) String() string
- type BehaviorOption
- func BehaviorOptFormHelpBlock(helpBlock interface{}) BehaviorOption
- func BehaviorOptFormValueDecoder(parser func([]string) (interface{}, error)) BehaviorOption
- func BehaviorOptFormValueEncoder(encoder func(interface{}) (string, error)) BehaviorOption
- func BehaviorOptName(name string) BehaviorOption
- func BehaviorOptVTypeOption(key string, value interface{}) BehaviorOption
- func BehaviorOptVTypeOptions(opts echo.H) BehaviorOption
- func BehaviorOptValue(defaultValue interface{}) BehaviorOption
- func BehaviorOptValueInitor(initor func() interface{}) BehaviorOption
- func BehaviorOptValueType(vt string) BehaviorOption
- type BehaviorPerms
- type Behaviors
- type CheckedBehavior
- type Handle
- func (u *Handle) Check(ctx echo.Context, parsed interface{}, current string) (interface{}, error)
- func (u *Handle) FireRender(ctx echo.Context) error
- func (u *Handle) Generate(ctx echo.Context) (string, error)
- func (u *Handle) IsValid(ctx echo.Context) bool
- func (u *Handle) ListItems(ctx echo.Context) ([]interface{}, error)
- func (u *Handle) OnRender(fn func(ctx echo.Context) error) Handler
- func (u *Handle) Parse(ctx echo.Context, rule string) (interface{}, error)
- func (u *Handle) SetChecker(...) Handler
- func (u *Handle) SetGenerator(fn func(ctx echo.Context) (string, error)) Handler
- func (u *Handle) SetIsValid(fn func(ctx echo.Context) bool) Handler
- func (u *Handle) SetItemLister(fn func(ctx echo.Context) ([]interface{}, error)) Handler
- func (u *Handle) SetParser(fn func(ctx echo.Context, rule string) (interface{}, error)) Handler
- func (u *Handle) SetTmpl(tmpl string, typ ...string) Handler
- func (u *Handle) Tmpl(typ ...string) string
- type Handler
- type Map
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPermActions ¶
func HandleBatchCheck ¶ added in v4.1.0
func HandleCheck ¶ added in v4.1.0
func HandleFireRender ¶ added in v4.1.0
func HandleGenerate ¶ added in v4.1.0
func JSONBytesParseError ¶
Types ¶
type Behavior ¶
type Behavior struct { Name string `json:",omitempty" xml:",omitempty"` ValueType string `json:",omitempty" xml:",omitempty"` // list / number / json VTypeOptions echo.H `json:",omitempty" xml:",omitempty"` Value interface{} `json:",omitempty" xml:",omitempty"` // 在Behaviors中登记时,代表默认值;在BehaviorPerms中登记时代表针对某个用户设置的值 FormHelpBlock interface{} // contains filtered or unexported fields }
func NewBehavior ¶
func NewBehavior(opts ...BehaviorOption) *Behavior
func (*Behavior) SetFormHelpBlock ¶
func (b *Behavior) SetFormHelpBlock(helpBlock interface{})
func (*Behavior) SetFormValueDecoder ¶
func (*Behavior) SetFormValueEncoder ¶
func (*Behavior) SetValueInitor ¶
func (b *Behavior) SetValueInitor(initor func() interface{})
type BehaviorOption ¶
type BehaviorOption func(*Behavior)
func BehaviorOptFormHelpBlock ¶
func BehaviorOptFormHelpBlock(helpBlock interface{}) BehaviorOption
func BehaviorOptFormValueDecoder ¶
func BehaviorOptFormValueDecoder(parser func([]string) (interface{}, error)) BehaviorOption
func BehaviorOptFormValueEncoder ¶
func BehaviorOptFormValueEncoder(encoder func(interface{}) (string, error)) BehaviorOption
func BehaviorOptName ¶
func BehaviorOptName(name string) BehaviorOption
func BehaviorOptVTypeOption ¶
func BehaviorOptVTypeOption(key string, value interface{}) BehaviorOption
func BehaviorOptVTypeOptions ¶
func BehaviorOptVTypeOptions(opts echo.H) BehaviorOption
func BehaviorOptValue ¶
func BehaviorOptValue(defaultValue interface{}) BehaviorOption
func BehaviorOptValueInitor ¶
func BehaviorOptValueInitor(initor func() interface{}) BehaviorOption
func BehaviorOptValueType ¶
func BehaviorOptValueType(vt string) BehaviorOption
type BehaviorPerms ¶
func ParseBehavior ¶
func ParseBehavior(permBehaviors string, behaviors *Behaviors) (BehaviorPerms, error)
func (BehaviorPerms) Add ¶
func (b BehaviorPerms) Add(be *Behavior, value ...interface{})
func (BehaviorPerms) CheckBehavior ¶
func (b BehaviorPerms) CheckBehavior(perm string) *CheckedBehavior
func (BehaviorPerms) Get ¶
func (b BehaviorPerms) Get(name string) Behavior
type Behaviors ¶
func NewBehaviors ¶
func NewBehaviors() *Behaviors
type CheckedBehavior ¶
type CheckedBehavior struct { Value interface{} Checked bool }
type Handle ¶ added in v4.1.0
type Handle struct {
// contains filtered or unexported fields
}
func (*Handle) SetChecker ¶ added in v4.1.0
func (*Handle) SetGenerator ¶ added in v4.1.0
func (*Handle) SetIsValid ¶ added in v4.1.0
func (*Handle) SetItemLister ¶ added in v4.1.0
type Handler ¶ added in v4.1.0
type Handler interface { SetGenerator(fn func(ctx echo.Context) (string, error)) Handler SetChecker(fn func(ctx echo.Context, parsed interface{}, current string) (interface{}, error)) Handler SetParser(fn func(ctx echo.Context, rule string) (interface{}, error)) Handler SetItemLister(fn func(ctx echo.Context) ([]interface{}, error)) Handler OnRender(fn func(ctx echo.Context) error) Handler SetIsValid(fn func(ctx echo.Context) bool) Handler SetTmpl(tmpl string, typ ...string) Handler Tmpl(typ ...string) string Generate(ctx echo.Context) (string, error) Check(ctx echo.Context, parsed interface{}, current string) (interface{}, error) Parse(ctx echo.Context, rule string) (interface{}, error) ListItems(ctx echo.Context) ([]interface{}, error) FireRender(ctx echo.Context) error IsValid(ctx echo.Context) bool }
Click to show internal directories.
Click to hide internal directories.