Documentation ¶
Index ¶
- Constants
- Variables
- func CanBeParam(name string) bool
- func DefaultOAuthParameter(name string) *inference.Parameter
- func ExtractParameterHints(text string, state *inference.State) error
- func GetHolderName(identifier string) (string, string)
- func GetHolderNameFromSelector(selector *expr.Select) (string, string)
- func IsStructQL(SQL string) bool
- func MergeStructs(args ...interface{}) ([]byte, error)
- func OnVeltyExpression() sqlparser.Option
- func ParseImports(ctx context.Context, expr *string, ...) error
- func RemoveParameterHints(text string, state inference.State) string
- func SplitByWhitespace(fragment string) []string
- func SplitHint(hint string) (marshal string, SQL string)
- type Context
- type Declaration
- type Declarations
- type Expression
- type ExpressionContext
- type Expressions
- type Statement
- type Statements
- type Template
- type TypeImport
- type TypeImports
Constants ¶
View Source
const ( ParenthesesBlockToken int IfBlockToken ComponentKeyword )
View Source
const ( InKeyword = "in" OrKeyword = "or" AndKeyword = "and" )
Variables ¶
View Source
var ComponentKeywordMatcher = parsly.NewToken(ComponentKeyword, "@component", matcher.NewFragment("@component"))
View Source
var IfBlockMatcher = parsly.NewToken(IfBlockToken, "if block", imatchers.NewIfBlock())
View Source
var ParenthesesBlockMatcher = parsly.NewToken(ParenthesesBlockToken, "Parentheses", matcher.NewBlock('(', ')', '\\'))
Functions ¶
func CanBeParam ¶
func DefaultOAuthParameter ¶
DefaultOAuthParameter creates a default oauht parameter
func GetHolderName ¶
func MergeStructs ¶
func OnVeltyExpression ¶
func ParseImports ¶
func ParseImports(ctx context.Context, expr *string, handler func(ctx context.Context, spec *TypeImport) error) error
ParseImports parse go types import statement
func SplitByWhitespace ¶
Types ¶
type Declaration ¶
type Declaration struct { inference.Parameter //ParametersState shorthands Auth string `json:",omitempty" yaml:",omitempty"` Kind string `json:",omitempty" yaml:",omitempty"` Location *string `json:",omitempty" yaml:",omitempty"` OutputType string `json:",omitempty" yaml:",omitempty"` Cardinality state.Cardinality `json:",omitempty" yaml:",omitempty"` StatusCode *int `json:",omitempty" yaml:",omitempty"` ErrorMessage *string `json:",omitempty" yaml:",omitempty"` TransformKind string `json:",omitempty" yaml:",omitempty"` Transformer string `json:",omitempty" yaml:",omitempty"` Codec string `json:",omitempty" yaml:",omitempty"` CodecArgs []string `json:",omitempty" yaml:",omitempty"` QuerySelector string `json:",omitempty" yaml:",omitempty"` Raw string }
func (*Declaration) AuthParameter ¶
func (d *Declaration) AuthParameter() *inference.Parameter
func (*Declaration) ExpandShorthands ¶
func (d *Declaration) ExpandShorthands()
func (*Declaration) Merge ¶
func (d *Declaration) Merge(from *Declaration) (*Declaration, error)
func (*Declaration) PathWithName ¶
func (d *Declaration) PathWithName() (string, string)
func (*Declaration) Transform ¶
func (d *Declaration) Transform() *marshal.Transform
type Declarations ¶
type Declarations struct { SQL string State inference.State OutputState inference.State AsyncState inference.State QuerySelectors map[string]inference.State Transforms []*marshal.Transform Items []*Declaration // contains filtered or unexported fields }
Declarations defines state (parameters) declaration
func NewDeclarations ¶
func (*Declarations) Init ¶
func (d *Declarations) Init() error
type Expression ¶
type ExpressionContext ¶
type ExpressionContext struct { Name string Context Context Function string Fragments []string Column string Type reflect.Type }
func NewParamContext ¶
func NewParamContext(name string, fnName string, context Context) *ExpressionContext
func (*ExpressionContext) BeforeElements ¶
func (c *ExpressionContext) BeforeElements() []string
func (*ExpressionContext) IsJSONCodec ¶
func (c *ExpressionContext) IsJSONCodec() bool
type Expressions ¶
type Expressions []*Expression
type Statements ¶
type Statements []*Statement
func NewStatements ¶
func NewStatements(SQL string) Statements
func (Statements) DMLTables ¶
func (s Statements) DMLTables(rawSQL string) []string
func (Statements) IsExec ¶
func (s Statements) IsExec() bool
type Template ¶
type Template struct { SQL string Declared map[string]bool State *inference.State Context []*ExpressionContext // contains filtered or unexported fields }
func (*Template) DetectTypes ¶
func (t *Template) DetectTypes(handler func(state *inference.State, parameter string, expression *ExpressionContext))
type TypeImport ¶
type TypeImport struct { URL string Types []string Alias string Methods []reflect.Method ForceGoTypeUse bool }
func (*TypeImport) EnsureLocation ¶
type TypeImports ¶
type TypeImports []*TypeImport
func (*TypeImports) Append ¶
func (t *TypeImports) Append(spec *TypeImport)
func (TypeImports) Lookup ¶
func (t TypeImports) Lookup(typeName string) *TypeImport
Source Files ¶
Click to show internal directories.
Click to hide internal directories.