ql

package
v0.0.0-...-6dc645d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyWords = []string{"null"}

Functions

func ParseAstValue

func ParseAstValue(ctx context.Context, value ast.Value, vars map[string]interface{}) (interface{}, error)

parseAstValue returns an interface that can be casted to string

Types

type GraphQLData

type GraphQLData struct {
	QLData
	Operation   string                 `json:"operation"`
	QueryObject map[string]QueryObject `json:"_"`
}

func (*GraphQLData) Execute

func (gqd *GraphQLData) Execute(ctx context.Context, projectId string, datasources map[string]*module_model.DataSource, s module_store.ModuleStoreI, outputType string) (res []map[string]interface{}, queryObjs []QueryObject, err error)

func (*GraphQLData) SetQLData

func (gqd *GraphQLData) SetQLData(ctx context.Context, mq module_model.MyQuery, vars map[string]interface{}, executeFlag bool, tokenObj map[string]interface{}, isPublic bool, outputType string)

type MapSorter

type MapSorter []*OrderedMap

func (MapSorter) Len

func (a MapSorter) Len() int

func (MapSorter) Less

func (a MapSorter) Less(i, j int) bool

func (MapSorter) Swap

func (a MapSorter) Swap(i, j int)

type OrderedMap

type OrderedMap struct {
	Rank     int
	Level    int
	SubLevel int
	Obj      map[string]interface{}
}

type QL

type QL interface {
	Execute(ctx context.Context, projectId string, datasources map[string]*module_model.DataSource, s module_store.ModuleStoreI, outputType string) (res []map[string]interface{}, queryObjs []QueryObject, err error)
	SetQLData(ctx context.Context, mq module_model.MyQuery, vars map[string]interface{}, executeFlag bool, tokenObj map[string]interface{}, isPublic bool, outputType string)
	ProcessTransformRule(ctx context.Context, tr module_model.TransformRule) (outputObj map[string]interface{}, err error)
}

func GetQL

func GetQL(queryType string) QL

type QLData

type QLData struct {
	Query          string                     `json:"query"`
	Variables      map[string]interface{}     `json:"variables"`
	FinalVariables map[string]interface{}     `json:"-"`
	ExecuteFlag    bool                       `json:"-"`
	SecurityRule   security_rule.SecurityRule `json:"security_rule"`
	IsPublic       bool                       `json:"is_public"`
	OutputType     string                     `json:"output_type"`
}

func (*QLData) ProcessTransformRule

func (qld *QLData) ProcessTransformRule(ctx context.Context, tr module_model.TransformRule) (outputObj map[string]interface{}, err error)

func (*QLData) SetFinalVars

func (qld *QLData) SetFinalVars(ctx context.Context, vars map[string]interface{}) (err error)

func (*QLData) SetQLDataCommon

func (qld *QLData) SetQLDataCommon(ctx context.Context, mq module_model.MyQuery, vars map[string]interface{}, executeFlag bool, tokenObj map[string]interface{}, isPublic bool, outputType string) (err error)

type QueryObject

type QueryObject struct {
	Query string
	Cols  string
	Type  string
}

type SQLCols

type SQLCols struct {
	ColWithAlias []string
	ColNames     []string
	GroupClause  []string
}

type SQLData

type SQLData struct {
	QLData
	DBAlias string `json:"dbalias"`
	Cols    string `json:"cols"`
}

func (*SQLData) Execute

func (sqd *SQLData) Execute(ctx context.Context, projectId string, datasources map[string]*module_model.DataSource, s module_store.ModuleStoreI, outputType string) (res []map[string]interface{}, queryObjs []QueryObject, err error)

func (*SQLData) SetQLData

func (sqd *SQLData) SetQLData(ctx context.Context, mq module_model.MyQuery, vars map[string]interface{}, executeFlag bool, tokenObj map[string]interface{}, isPublic bool, outputType string)

type SQLObjectM

type SQLObjectM struct {
	MainTableName       string
	MainAliasName       string
	MutationRecords     []module_model.MutationRecord
	TxnFlag             bool
	QueryType           string
	MutationReturn      module_model.MutationReturn
	MutationSelectQuery string
	MutationSelectCols  string
	NestedDoc           bool
	SingleTxn           bool

	//MainTableDB     string
	WhereClause interface{}
	QueryObject map[string]QueryObject
	DBQuery     string
	//SortClause      interface{}
	//JoinClause      map[string]interface{}
	//DistinctResults bool
	//HasAggregate    bool
	//Limit           int
	//Skip            int
	//Columns         SQLCols
	//tables          [][]module_model.Tables
	//tableNames      map[string]string
	//queryLevel      int
	//querySubLevel   []int
	PreparedQuery bool
	OverwriteDoc  map[string]map[string]interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*SQLObjectM) MakeMutationQuery

func (sqlObj *SQLObjectM) MakeMutationQuery(ctx context.Context, doc *module_model.MutationRecord, tableName string)

func (*SQLObjectM) ProcessMutationGraphQL

func (sqlObj *SQLObjectM) ProcessMutationGraphQL(ctx context.Context, sel ast.Selection, vars map[string]interface{}, datasource *module_model.DataSource) (err error)

type SQLObjectQ

type SQLObjectQ struct {
	ProjectId       string
	FinalVariables  map[string]interface{}
	MainTableName   string
	MainAliasName   string
	MainTableDB     string
	WhereClause     interface{}
	SortClause      interface{}
	JoinClause      []*OrderedMap //map[string]interface{}
	DistinctResults bool
	HasAggregate    bool
	Limit           int
	Skip            int
	Columns         SQLCols

	DBQuery        string
	OverwriteDoc   map[string]map[string]interface{} `json:"-"`
	SecurityClause map[string]string                 `json:"-"`
	WithQuery      string                            `json:"-"`
	// contains filtered or unexported fields
}

func (*SQLObjectQ) MakeQuery

func (sqlObj *SQLObjectQ) MakeQuery(ctx context.Context, sqlMaker ds.SqlMakerI, withColAlias bool) (err error)

func (*SQLObjectQ) ProcessGraphQL

func (sqlObj *SQLObjectQ) ProcessGraphQL(ctx context.Context, sel ast.Selection, datasource *module_model.DataSource, sqlMaker ds.SqlMakerI, vars map[string]interface{}, s module_store.ModuleStoreI, withColAlias bool) (err error)

Jump to

Keyboard shortcuts

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