action

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BeforeExec = iota
	AfterExec
	BeforeDo
	AfterDo
)

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 {
	// contains filtered or unexported fields
}

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

func New

func New(ctx context.Context, method string, req g.Map) *Action

func (*Action) Result

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

type Hook

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

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

type Node

type Node struct {
	Key       string
	TableName string
	Role      string

	Data   []g.Map // 需写入数据库的数据
	Where  []g.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