runtimehelper

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineSimpleQuery

func CombineSimpleQuery(elements []ConditionElement, relation Relation) (string, []interface{})

func GetDbIdFields

func GetDbIdFields(d *ast.Definition, fieldName string) string

func GetNestedPreloadSelection

func GetNestedPreloadSelection(data PreloadFields, dbObj *gorm.DB) *gorm.DB

func GetNestedPreloads

func GetNestedPreloads(ctx *graphql.OperationContext, fields []graphql.CollectedField, prefix string) (preloads []string)

func GetPreloadSelection

func GetPreloadSelection(ctx context.Context, dbObj *gorm.DB, data PreloadFields) *gorm.DB

func GetPreloadString

func GetPreloadString(prefix, name string) string

func GetPreloads

func GetPreloads(ctx context.Context) []string

func GetQuoteChar added in v0.1.0

func GetQuoteChar(db *gorm.DB) string

func ShouldFieldBeIgnored

func ShouldFieldBeIgnored(d *ast.Definition, fieldName string) bool

Types

type Clausel

type Clausel = string
const (
	Clausel_Eq           Clausel = "eq"
	Clausel_Eqi          Clausel = "eqi"
	Clausel_Ne           Clausel = "ne"
	Clausel_StartsWith   Clausel = "startsWith"
	Clausel_EndsWith     Clausel = "endsWith"
	Clausel_Contains     Clausel = "contains"
	Clausel_NotContains  Clausel = "notContains"
	Clausel_NotContainsI Clausel = "notContainsi"
	Clausel_ContainsI    Clausel = "containsi"
	Clausel_Null         Clausel = "null"
	Clausel_NotNull      Clausel = "notNull"
	Clausel_IN           Clausel = "in"
	Clausel_NotIN        Clausel = "noIn"
)

type ConditionElement

type ConditionElement struct {
	Operator         string             `json:"operator,omitempty"`
	Field            string             `json:"field,omitempty"`
	Value            []interface{}      `json:"value,omitempty"`
	Children         []ConditionElement `json:"children,omitempty"`
	ChildrenRelation Relation           `json:"children_relation,omitempty"`
}

func Between

func Between(field string, start, end interface{}) ConditionElement

func Complex

func Complex(relation Relation, elems ...ConditionElement) ConditionElement

func Equal

func Equal(field string, value interface{}) ConditionElement

func In

func In(field string, value interface{}) ConditionElement

func Less

func Less(field string, value interface{}) ConditionElement

func LessOrEqual

func LessOrEqual(field string, value interface{}) ConditionElement

func Like

func Like(field string, value interface{}) ConditionElement

func More

func More(field string, value interface{}) ConditionElement

func MoreOrEqual

func MoreOrEqual(field string, value interface{}) ConditionElement

func NewConditionElement

func NewConditionElement(operator, field string, value ...interface{}) ConditionElement

func NotEqual

func NotEqual(field string, value interface{}) ConditionElement

func NotIn

func NotIn(field string, value interface{}) ConditionElement

func NotLike

func NotLike(field string, value interface{}) ConditionElement

func NotNull

func NotNull(field string, value interface{}) ConditionElement

func Null

func Null(field string, value interface{}) ConditionElement

type PreloadFields

type PreloadFields struct {
	Fields      []string
	TableName   string
	SubTables   []PreloadFields
	PreloadName string
}

func GetNestedPreloadsMap

func GetNestedPreloadsMap(ctx *graphql.OperationContext, fields []graphql.CollectedField, tableName, parentTableName string) PreloadFields

func GetPreloadsMap

func GetPreloadsMap(ctx context.Context, tableName string) PreloadFields

type Relation

type Relation string
const (
	RelationAnd Relation = "AND"
	RelationOr  Relation = "OR"
	RelationNot Relation = "NOT"
)

Jump to

Keyboard shortcuts

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