dsl

package
v0.0.0-...-b185596 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disintegration

func Disintegration(v Value) []interface{}

Types

type Agg

type Agg map[string]struct {
	Field string `json:"field"`
}

type Aggs

type Aggs map[string]Agg

type Bool

type Bool map[string][]Query

type CountReq

type CountReq struct {
	TableName string
	DSL       DSL
}

type CountResp

type CountResp struct {
	Data int64
}

type DSL

type DSL struct {
	QY map[string]interface{} `json:"query"`

	Query Query
	Bool  Bool

	Aggs Aggs `json:"aggs"`
}

type DSLService

type DSLService interface {
	FindOne(ctx context.Context, req *FindOneReq) (*FindOneResp, error)
	Find(ctx context.Context, req *FindReq) (*FindResp, error)
	Count(ctx context.Context, req *CountReq) (*CountResp, error)
	Insert(ctx context.Context, req *InsertReq) (*InsertResp, error)
	Update(ctx context.Context, req *UpdateReq) (*UpdateResp, error)
	Delete(ctx context.Context, req *DeleteReq) (*DeleteResp, error)
}

func New

func New(ctx context.Context, opts ...Option) DSLService

type DeleteReq

type DeleteReq struct {
	TableName string
	DSL       DSL
}

type DeleteResp

type DeleteResp struct {
	Count int64
}

type Field

type Field map[string]Value

type FindOneReq

type FindOneReq struct {
	TableName string
	DSL       DSL
}

type FindOneResp

type FindOneResp struct {
	Data interface{}
}

type FindReq

type FindReq struct {
	TableName string
	Page      int64
	Size      int64
	Sort      []string
	DSL       DSL
}

type FindResp

type FindResp struct {
	Data  []interface{}
	Count int64
}

type InsertReq

type InsertReq struct {
	TableName string
	Entities  []interface{}
}

type InsertResp

type InsertResp struct {
	Count int64
}

type Option

type Option func(*dsl)

func WithDB

func WithDB(db dorm.Dorm) Option

type Query

type Query map[string]Field

type UpdateReq

type UpdateReq struct {
	TableName string
	DSL       DSL
	Entity    interface{}
}

type UpdateResp

type UpdateResp struct {
	Count int64
}

type Value

type Value interface{}

func NewValue

func NewValue(values ...interface{}) Value

Jump to

Keyboard shortcuts

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