action

package
v0.2.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BeforeNodeExec = iota
	AfterNodeExec
	BeforeExecutorDo
	AfterExecutorDo
)

Variables

This section is empty.

Functions

func EmitHook

func EmitHook(ctx context.Context, hookAt int, node *Node, method string) error

func RegHook

func RegHook(h Hook)

Types

type Action

type Action struct {

	// 关闭 access 权限验证, 默认否
	NoAccessVerify bool
	// 关闭 request 验证开关, 默认否
	NoRequestVerify bool

	// dbFieldStyle 数据库字段命名风格 请求传递到数据库中
	DbFieldStyle config.FieldStyle

	// jsonFieldStyle 数据库返回的字段
	JsonFieldStyle config.FieldStyle
	// contains filtered or unexported fields
}

Action 非get查询的request表中的请求

func New

func New(ctx context.Context, actionConfig *config.ActionConfig, method string, req model.Map) *Action

func (*Action) Result

func (a *Action) Result() (model.Map, error)

type Hook

type Hook struct {
	For string //
	// Exec 事务外
	BeforeNodeExec func(ctx context.Context, n *Node, method string) error
	AfterNodeExec  func(ctx context.Context, n *Node, method string) error

	// Do 事务内
	BeforeExecutorDo func(ctx context.Context, n *Node, method string) error
	AfterExecutorDo  func(ctx context.Context, n *Node, method string) error
}

type Node

type Node struct {
	Key    string
	IsList bool

	Role string

	Data   []model.Map // 需写入数据库的数据
	Where  []model.Map // 条件
	Ret    model.Map   // 节点返回值
	RowKey string      // 主键
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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