Documentation
¶
Overview ¶
Package sqlbind parses and compiles typed SQL template sources.
Index ¶
- func Generate(filename string, source []byte, options GenerateOptions) ([]byte, error)
- type BinaryExpr
- type Body
- type CallExpr
- type CompileError
- type ConditionalExpr
- type Declaration
- type EnumDecl
- type ExecutorResolver
- type Expr
- type ExpressionNode
- type ExternalDecl
- type Field
- type ForNode
- type GenerateOptions
- type IdentifierExpr
- type IfNode
- type IndexExpr
- type LiteralExpr
- type MemberExpr
- type Module
- type Node
- type Parameter
- type ParseError
- type Position
- type RelationNode
- type TemplateDecl
- type TextNode
- type TypeDecl
- type TypeRef
- type UnaryExpr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BinaryExpr ¶
type BinaryExpr = syntax.BinaryExpr
type CompileError ¶
func (*CompileError) Error ¶
func (e *CompileError) Error() string
type ConditionalExpr ¶
type ConditionalExpr = syntax.ConditionalExpr
type Declaration ¶
type Declaration = syntax.Declaration
type ExecutorResolver ¶ added in v0.1.6
ExecutorResolver identifies a package function with the signature func(context.Context) (SQLExecutor, error).
type ExpressionNode ¶
type ExpressionNode = syntax.ExpressionNode
type ExternalDecl ¶
type ExternalDecl = syntax.ExternalDecl
type GenerateOptions ¶
type GenerateOptions struct {
Package string
// PlaceholderStyle is "dollar" (the PostgreSQL default) or "question".
PlaceholderStyle string
// ContextAPI adds <Component>Context wrappers which resolve an executor
// from context.Context while preserving the explicit executor APIs.
ContextAPI bool
// ExecutorResolver selects a framework-specific Context resolver. A nil
// resolver uses sqlbind.SQLExecutorFromContext. Setting it implies ContextAPI.
ExecutorResolver *ExecutorResolver
}
GenerateOptions controls SQL code generation.
type IdentifierExpr ¶
type IdentifierExpr = syntax.IdentifierExpr
type LiteralExpr ¶
type LiteralExpr = syntax.LiteralExpr
type MemberExpr ¶
type MemberExpr = syntax.MemberExpr
type ParseError ¶
type ParseError = syntax.ParseError
type RelationNode ¶
type RelationNode struct {
Kind string `json:"kind"`
Pos Position `json:"pos"`
Name string `json:"name"`
Arguments []Expr `json:"arguments,omitempty"`
Alias string `json:"alias"`
}
RelationNode is a structurally embedded private sql.relation<T> statement. It is emitted into the caller's builder, so placeholders remain globally ordered after runtime conditions are resolved.
func (*RelationNode) NodeType ¶
func (n *RelationNode) NodeType() string
type TemplateDecl ¶
type TemplateDecl = syntax.TemplateDecl
Click to show internal directories.
Click to hide internal directories.