query

package
v0.2.0-beta11 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeTypeStruct = iota // 结构节点
	NodeTypeQuery         // 查询节点
	NodeTypeRef           // 引用节点
	NodeTypeFunc          // functions 节点
)

Variables

This section is empty.

Functions

func QueryExecutorList

func QueryExecutorList() []string

func RegExecutor

func RegExecutor(name string, e queryExecutorBuilder)

Types

type Node

type Node struct {

	// 当前节点key Todos, 如果Todo[], 保存为Todo
	Key string
	// 当前节点path -> []/Todos
	Path string
	// 节点类型
	Type int

	// 字段映射
	Column map[string]string
	// contains filtered or unexported fields
}

func (*Node) Result

func (n *Node) Result() (any, error)

type NodeRef

type NodeRef struct {
	// contains filtered or unexported fields
}

NodeRef 节点依赖引用

type Page

type Page struct {
	Count int
	Page  int
}

type Query

type Query struct {

	// 输出过程
	PrintProcessLog bool

	// 关闭权限验证 , 默认否
	NoAccessVerify bool

	// 自定义可访问权限的限定, 例如添加用户id的where条件
	AccessCondition config.AccessCondition

	DbMeta *config.DBMeta

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

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

func New

func New(ctx context.Context, qc *config.QueryConfig, req model.Map) *Query

func (*Query) Result

func (q *Query) Result() (model.Map, error)

type QueryExecutor

type QueryExecutor interface {
	ParseCondition(conditions model.MapStrAny, accessVerify bool) error
	ParseCtrl(ctrl model.Map) error
	List(page int, count int) (list []model.Map, err error)
	Count() (total int64, err error)
	One() (model.Map, error)
	SetEmptyResult()
}

func NewExecutor

func NewExecutor(name string, ctx context.Context, config *config.ExecutorConfig) (QueryExecutor, error)

type RefNode

type RefNode struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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