Documentation
¶
Index ¶
- Variables
- func CallSqlFunction(ctx *sql.Context, f SQLFunction, runner sql.StatementRunner, args []any) (any, error)
- func ConvertGMSValueToDoltgresValue(ctx *sql.Context, sqlTyp sql.Type, val any) (any, error)
- func FindCommonType(ctx *sql.Context, types []*pgtypes.DoltgresType) (_ *pgtypes.DoltgresType, requiresCasts bool, err error)
- func Initialize(astConvert func(parser.Statement) (sqlparser.Statement, error))
- func MustAddAssignmentTypeCast(builtInCasts map[id.Cast]casts.Cast, cast TypeCast)
- func MustAddExplicitTypeCast(builtInCasts map[id.Cast]casts.Cast, cast TypeCast)
- func MustAddImplicitTypeCast(builtInCasts map[id.Cast]casts.Cast, cast TypeCast)
- func RegisterAggregateFunction(f AggregateFunctionInterface)
- func RegisterBinaryFunction(operator Operator, f Function2)
- func RegisterFunction(f FunctionInterface)
- func RegisterUnaryFunction(operator Operator, f Function1)
- func RegisterWindowFunction(f WindowFunctionInterface)
- func ReplaceFunctionColumn(parsedAST tree.Statement, params map[string]*ParamTypAndValue) error
- func ReplaceUnresolvedToFunctionColumn(paramMap map[string]*ParamTypAndValue, expr tree.Expr) tree.Expr
- type AggregateFunction
- type AggregateFunctionInterface
- type CompiledAggregateFunction
- func (c *CompiledAggregateFunction) Children() []sql.Expression
- func (c *CompiledAggregateFunction) DebugString(ctx *sql.Context) string
- func (c *CompiledAggregateFunction) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *CompiledAggregateFunction) Id() sql.ColumnId
- func (c *CompiledAggregateFunction) NewBuffer(ctx *sql.Context) (sql.AggregationBuffer, error)
- func (c *CompiledAggregateFunction) NewWindowFunction(ctx *sql.Context) (sql.WindowFunction, error)
- func (c *CompiledAggregateFunction) SetStatementRunner(ctx *sql.Context, runner sql.StatementRunner) sql.Expression
- func (c *CompiledAggregateFunction) String() string
- func (c *CompiledAggregateFunction) Window() *sql.WindowDefinition
- func (c *CompiledAggregateFunction) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
- func (c *CompiledAggregateFunction) WithId(id sql.ColumnId) sql.IdExpression
- func (c *CompiledAggregateFunction) WithWindow(ctx *sql.Context, window *sql.WindowDefinition) sql.WindowAdaptableExpression
- type CompiledFunction
- func (c *CompiledFunction) Children() []sql.Expression
- func (c *CompiledFunction) Description() string
- func (c *CompiledFunction) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *CompiledFunction) EvalRowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error)
- func (c *CompiledFunction) FunctionName() string
- func (c *CompiledFunction) GetQuickFunction(ctx *sql.Context) QuickFunction
- func (c *CompiledFunction) IsNonDeterministic() bool
- func (c *CompiledFunction) IsNullable(ctx *sql.Context) bool
- func (c *CompiledFunction) IsSRF() bool
- func (c *CompiledFunction) IsStrict() bool
- func (c *CompiledFunction) IsVariadic() bool
- func (c *CompiledFunction) OutParametersSchema() sql.Schema
- func (c *CompiledFunction) OverloadString(types []*pgtypes.DoltgresType) string
- func (c *CompiledFunction) ResolveDefaultValues(ctx *sql.Context, getDefExpr func(defExpr string) (sql.Expression, error)) error
- func (c *CompiledFunction) Resolved() bool
- func (c *CompiledFunction) ReturnsRowIter() bool
- func (c *CompiledFunction) SetStatementRunner(ctx *sql.Context, runner sql.StatementRunner) sql.Expression
- func (c *CompiledFunction) StashedError() error
- func (c *CompiledFunction) String() string
- func (c *CompiledFunction) Type(ctx *sql.Context) sql.Type
- func (c *CompiledFunction) Unwrap(v any) sql.Row
- func (c *CompiledFunction) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
- type CompiledWindowFunction
- func (c *CompiledWindowFunction) Children() []sql.Expression
- func (c *CompiledWindowFunction) DebugString(ctx *sql.Context) string
- func (c *CompiledWindowFunction) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *CompiledWindowFunction) Id() sql.ColumnId
- func (c *CompiledWindowFunction) NewWindowFunction(ctx *sql.Context) (sql.WindowFunction, error)
- func (c *CompiledWindowFunction) SetStatementRunner(ctx *sql.Context, runner sql.StatementRunner) sql.Expression
- func (c *CompiledWindowFunction) String() string
- func (c *CompiledWindowFunction) Window() *sql.WindowDefinition
- func (c *CompiledWindowFunction) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
- func (c *CompiledWindowFunction) WithId(id sql.ColumnId) sql.IdExpression
- func (c *CompiledWindowFunction) WithWindow(ctx *sql.Context, window *sql.WindowDefinition) sql.WindowAdaptableExpression
- type ExtensionFunction
- func (extFunc ExtensionFunction) GetExpectedParameterCount() int
- func (extFunc ExtensionFunction) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (extFunc ExtensionFunction) GetName() string
- func (extFunc ExtensionFunction) GetOutParameters() sql.Schema
- func (extFunc ExtensionFunction) GetReturn() *pgtypes.DoltgresType
- func (extFunc ExtensionFunction) InternalID() id.Id
- func (extFunc ExtensionFunction) IsCVariadic() bool
- func (extFunc ExtensionFunction) IsSRF() bool
- func (extFunc ExtensionFunction) IsStrict() bool
- func (extFunc ExtensionFunction) NonDeterministic() bool
- func (extFunc ExtensionFunction) VariadicIndex() int
- type Func0Window
- type Func1Aggregate
- type Func1Window
- type Func2Window
- type Function
- type Function0
- func (f Function0) GetExpectedParameterCount() int
- func (f Function0) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function0) GetName() string
- func (f Function0) GetOutParameters() sql.Schema
- func (f Function0) GetReturn() *pgtypes.DoltgresType
- func (f Function0) InternalID() id.Id
- func (f Function0) IsCVariadic() bool
- func (f Function0) IsSRF() bool
- func (f Function0) IsStrict() bool
- func (f Function0) NonDeterministic() bool
- func (f Function0) VariadicIndex() int
- type Function1
- func (f Function1) GetExpectedParameterCount() int
- func (f Function1) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function1) GetName() string
- func (f Function1) GetOutParameters() sql.Schema
- func (f Function1) GetReturn() *pgtypes.DoltgresType
- func (f Function1) InternalID() id.Id
- func (f Function1) IsCVariadic() bool
- func (f Function1) IsSRF() bool
- func (f Function1) IsStrict() bool
- func (f Function1) NonDeterministic() bool
- func (f Function1) VariadicIndex() int
- type Function1N
- func (f Function1N) GetExpectedParameterCount() int
- func (f Function1N) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function1N) GetName() string
- func (f Function1N) GetOutParameters() sql.Schema
- func (f Function1N) GetReturn() *pgtypes.DoltgresType
- func (f Function1N) InternalID() id.Id
- func (f Function1N) IsCVariadic() bool
- func (f Function1N) IsSRF() bool
- func (f Function1N) IsStrict() bool
- func (f Function1N) NonDeterministic() bool
- func (f Function1N) VariadicIndex() int
- type Function2
- func (f Function2) GetExpectedParameterCount() int
- func (f Function2) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function2) GetName() string
- func (f Function2) GetOutParameters() sql.Schema
- func (f Function2) GetReturn() *pgtypes.DoltgresType
- func (f Function2) InternalID() id.Id
- func (f Function2) IsCVariadic() bool
- func (f Function2) IsSRF() bool
- func (f Function2) IsStrict() bool
- func (f Function2) NonDeterministic() bool
- func (f Function2) VariadicIndex() int
- type Function2N
- func (f Function2N) GetExpectedParameterCount() int
- func (f Function2N) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function2N) GetName() string
- func (f Function2N) GetOutParameters() sql.Schema
- func (f Function2N) GetReturn() *pgtypes.DoltgresType
- func (f Function2N) InternalID() id.Id
- func (f Function2N) IsCVariadic() bool
- func (f Function2N) IsSRF() bool
- func (f Function2N) IsStrict() bool
- func (f Function2N) NonDeterministic() bool
- func (f Function2N) VariadicIndex() int
- type Function3
- func (f Function3) GetExpectedParameterCount() int
- func (f Function3) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function3) GetName() string
- func (f Function3) GetOutParameters() sql.Schema
- func (f Function3) GetReturn() *pgtypes.DoltgresType
- func (f Function3) InternalID() id.Id
- func (f Function3) IsCVariadic() bool
- func (f Function3) IsSRF() bool
- func (f Function3) IsStrict() bool
- func (f Function3) NonDeterministic() bool
- func (f Function3) VariadicIndex() int
- type Function4
- func (f Function4) GetExpectedParameterCount() int
- func (f Function4) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function4) GetName() string
- func (f Function4) GetOutParameters() sql.Schema
- func (f Function4) GetReturn() *pgtypes.DoltgresType
- func (f Function4) InternalID() id.Id
- func (f Function4) IsCVariadic() bool
- func (f Function4) IsSRF() bool
- func (f Function4) IsStrict() bool
- func (f Function4) NonDeterministic() bool
- func (f Function4) VariadicIndex() int
- type Function5
- func (f Function5) GetExpectedParameterCount() int
- func (f Function5) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function5) GetName() string
- func (f Function5) GetOutParameters() sql.Schema
- func (f Function5) GetReturn() *pgtypes.DoltgresType
- func (f Function5) InternalID() id.Id
- func (f Function5) IsCVariadic() bool
- func (f Function5) IsSRF() bool
- func (f Function5) IsStrict() bool
- func (f Function5) NonDeterministic() bool
- func (f Function5) VariadicIndex() int
- type Function6
- func (f Function6) GetExpectedParameterCount() int
- func (f Function6) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function6) GetName() string
- func (f Function6) GetOutParameters() sql.Schema
- func (f Function6) GetReturn() *pgtypes.DoltgresType
- func (f Function6) InternalID() id.Id
- func (f Function6) IsCVariadic() bool
- func (f Function6) IsSRF() bool
- func (f Function6) IsStrict() bool
- func (f Function6) NonDeterministic() bool
- func (f Function6) VariadicIndex() int
- type Function7
- func (f Function7) GetExpectedParameterCount() int
- func (f Function7) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (f Function7) GetName() string
- func (f Function7) GetOutParameters() sql.Schema
- func (f Function7) GetReturn() *pgtypes.DoltgresType
- func (f Function7) InternalID() id.Id
- func (f Function7) IsCVariadic() bool
- func (f Function7) IsSRF() bool
- func (f Function7) IsStrict() bool
- func (f Function7) NonDeterministic() bool
- func (f Function7) VariadicIndex() int
- type FunctionInterface
- type FunctionProvider
- type IntermediateFunction
- type InterpretedFunction
- func (InterpretedFunction) ApplyBindings(ctx *sql.Context, stack plpgsql.InterpreterStack, stmt string, ...) (newStmt string, varFound bool, err error)
- func (iFunc InterpretedFunction) GetAllNames() []string
- func (iFunc InterpretedFunction) GetExpectedParameterCount() int
- func (iFunc InterpretedFunction) GetInputParameterNamesAndTypes() ([]string, []*pgtypes.DoltgresType)
- func (iFunc InterpretedFunction) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (iFunc InterpretedFunction) GetName() string
- func (iFunc InterpretedFunction) GetOutParameters() sql.Schema
- func (iFunc InterpretedFunction) GetOutputParameterNamesAndTypes() ([]string, []*pgtypes.DoltgresType)
- func (iFunc InterpretedFunction) GetReturn() *pgtypes.DoltgresType
- func (iFunc InterpretedFunction) GetStatements() []plpgsql.InterpreterOperation
- func (iFunc InterpretedFunction) InternalID() id.Id
- func (iFunc InterpretedFunction) IsCVariadic() bool
- func (iFunc InterpretedFunction) IsSRF() bool
- func (iFunc InterpretedFunction) IsStrict() bool
- func (iFunc InterpretedFunction) NonDeterministic() bool
- func (iFunc InterpretedFunction) QueryMultiReturn(ctx *sql.Context, stack plpgsql.InterpreterStack, stmt string, ...) (schema sql.Schema, rows []sql.Row, err error)
- func (iFunc InterpretedFunction) QuerySingleReturn(ctx *sql.Context, stack plpgsql.InterpreterStack, stmt string, ...) (val any, err error)
- func (iFunc InterpretedFunction) VariadicIndex() int
- type NewBufferFn
- type NewWindowFunctionFn
- type Operator
- type Overload
- type Overloads
- type ParamTypAndValue
- type QuickFunction
- type QuickFunction1
- func (q *QuickFunction1) Call(ctx *sql.Context, arg0 any) (interface{}, error)
- func (q *QuickFunction1) CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
- func (q *QuickFunction1) Children() []sql.Expression
- func (q *QuickFunction1) Description() string
- func (q *QuickFunction1) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (q *QuickFunction1) EvalRowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error)
- func (q *QuickFunction1) FunctionName() string
- func (q *QuickFunction1) IsNonDeterministic() bool
- func (q *QuickFunction1) IsNullable(ctx *sql.Context) bool
- func (q *QuickFunction1) Resolved() bool
- func (q *QuickFunction1) ResolvedTypes() []*pgtypes.DoltgresType
- func (q *QuickFunction1) ReturnsRowIter() bool
- func (q *QuickFunction1) String() string
- func (q *QuickFunction1) Type(ctx *sql.Context) sql.Type
- func (q *QuickFunction1) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
- func (q *QuickFunction1) WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
- type QuickFunction2
- func (q *QuickFunction2) Call(ctx *sql.Context, arg0 any, arg1 any) (interface{}, error)
- func (q *QuickFunction2) CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
- func (q *QuickFunction2) Children() []sql.Expression
- func (q *QuickFunction2) Description() string
- func (q *QuickFunction2) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (q *QuickFunction2) EvalRowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error)
- func (q *QuickFunction2) FunctionName() string
- func (q *QuickFunction2) IsNonDeterministic() bool
- func (q *QuickFunction2) IsNullable(ctx *sql.Context) bool
- func (q *QuickFunction2) Resolved() bool
- func (q *QuickFunction2) ResolvedTypes() []*pgtypes.DoltgresType
- func (q *QuickFunction2) ReturnsRowIter() bool
- func (q *QuickFunction2) String() string
- func (q *QuickFunction2) Type(ctx *sql.Context) sql.Type
- func (q *QuickFunction2) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
- func (q *QuickFunction2) WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
- type QuickFunction3
- func (q *QuickFunction3) Call(ctx *sql.Context, arg0 any, arg1 any, arg2 any) (interface{}, error)
- func (q *QuickFunction3) CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
- func (q *QuickFunction3) Children() []sql.Expression
- func (q *QuickFunction3) Description() string
- func (q *QuickFunction3) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (q *QuickFunction3) EvalRowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error)
- func (q *QuickFunction3) FunctionName() string
- func (q *QuickFunction3) IsNonDeterministic() bool
- func (q *QuickFunction3) IsNullable(ctx *sql.Context) bool
- func (q *QuickFunction3) Resolved() bool
- func (q *QuickFunction3) ResolvedTypes() []*pgtypes.DoltgresType
- func (q *QuickFunction3) ReturnsRowIter() bool
- func (q *QuickFunction3) String() string
- func (q *QuickFunction3) Type(ctx *sql.Context) sql.Type
- func (q *QuickFunction3) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
- func (q *QuickFunction3) WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
- type SQLFunction
- func (sqlFunc SQLFunction) GetExpectedParameterCount() int
- func (sqlFunc SQLFunction) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (sqlFunc SQLFunction) GetName() string
- func (sqlFunc SQLFunction) GetOutParameters() sql.Schema
- func (sqlFunc SQLFunction) GetReturn() *pgtypes.DoltgresType
- func (sqlFunc SQLFunction) InternalID() id.Id
- func (sqlFunc SQLFunction) IsCVariadic() bool
- func (sqlFunc SQLFunction) IsSRF() bool
- func (sqlFunc SQLFunction) IsStrict() bool
- func (sqlFunc SQLFunction) NonDeterministic() bool
- func (sqlFunc SQLFunction) VariadicIndex() int
- type TypeCast
- type UserAggregate
- func (agg UserAggregate) GetExpectedParameterCount() int
- func (agg UserAggregate) GetInputParameterTypes() []*pgtypes.DoltgresType
- func (agg UserAggregate) GetName() string
- func (agg UserAggregate) GetOutParameters() sql.Schema
- func (agg UserAggregate) GetReturn() *pgtypes.DoltgresType
- func (agg UserAggregate) InternalID() id.Id
- func (agg UserAggregate) IsCVariadic() bool
- func (agg UserAggregate) IsSRF() bool
- func (agg UserAggregate) IsStrict() bool
- func (agg UserAggregate) NewBuffer(exprs []sql.Expression) (sql.AggregationBuffer, error)
- func (agg UserAggregate) NewWindowFunc() NewWindowFunctionFn
- func (agg UserAggregate) NonDeterministic() bool
- func (agg UserAggregate) VariadicIndex() int
- type UserFunctionCall
- type WindowFramerState
- func (s *WindowFramerState) BindFramer(window *sql.WindowDefinition) error
- func (s *WindowFramerState) DefaultFramer() sql.WindowFramer
- func (s *WindowFramerState) Dispose(ctx *sql.Context)
- func (s *WindowFramerState) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error
- type WindowFunctionInterface
- type WindowOnlyFunction
Constants ¶
This section is empty.
Variables ¶
var AggregateCatalog = map[string][]AggregateFunctionInterface{}
AggregateCatalog contains all of the PostgreSQL aggregate functions.
var Catalog = map[string][]FunctionInterface{}
Catalog contains all of the PostgreSQL functions.
var ErrFunctionDoesNotExist = errors.NewKind(`function %s does not exist`)
ErrFunctionDoesNotExist is returned when the function in use cannot be found.
var WindowCatalog = map[string][]WindowFunctionInterface{}
WindowCatalog contains all of the PostgreSQL functions that may only be used as window functions.
Functions ¶
func CallSqlFunction ¶ added in v0.52.1
func CallSqlFunction(ctx *sql.Context, f SQLFunction, runner sql.StatementRunner, args []any) (any, error)
CallSqlFunction runs the given SQL definition inside the function on the given runner.
func ConvertGMSValueToDoltgresValue ¶ added in v0.57.3
ConvertGMSValueToDoltgresValue converts a value produced by an expression with the given GMS type into the Go representation expected by the Doltgres type most similar to it (the type that pgtypes.FromGmsTypeToDoltgresType returns). Expressions with GMS types appear wherever tables or functions are implemented in GMS rather than Doltgres, most notably the dolt_* system tables, whose values (e.g. the uint64 counts of dolt_statistics) don't necessarily match the Go representation that Doltgres consumers of the corresponding Doltgres type expect.
func FindCommonType ¶ added in v0.11.1
func FindCommonType(ctx *sql.Context, types []*pgtypes.DoltgresType) (_ *pgtypes.DoltgresType, requiresCasts bool, err error)
FindCommonType returns the common type that given types can convert to. Returns false if no implicit casts are needed to resolve the given types as the returned common type. https://www.postgresql.org/docs/15/typeconv-union-case.html
func Initialize ¶
Initialize handles the initialization of the catalog by overwriting the built-in GMS functions, since they do not apply to PostgreSQL (and functions of the same name often have different behavior).
func MustAddAssignmentTypeCast ¶ added in v0.8.0
MustAddAssignmentTypeCast registers the given assignment type cast. Panics if an error occurs.
func MustAddExplicitTypeCast ¶ added in v0.6.0
MustAddExplicitTypeCast registers the given explicit type cast. Panics if an error occurs.
func MustAddImplicitTypeCast ¶ added in v0.6.0
MustAddImplicitTypeCast registers the given implicit type cast. Panics if an error occurs.
func RegisterAggregateFunction ¶ added in v0.51.0
func RegisterAggregateFunction(f AggregateFunctionInterface)
RegisterAggregateFunction registers the given function, so that it will be usable from a running server. This should be called from within an init().
func RegisterBinaryFunction ¶
RegisterBinaryFunction registers the given function, so that it will be usable from a running server. This should only be used for binary functions, which are the underlying functions for binary operators such as addition, subtraction, etc. This should be called from within an init().
func RegisterFunction ¶
func RegisterFunction(f FunctionInterface)
RegisterFunction registers the given function, so that it will be usable from a running server. This should be called from within an init().
func RegisterUnaryFunction ¶
RegisterUnaryFunction registers the given function, so that it will be usable from a running server. This should only be used for unary functions, which are the underlying functions for unary operators such as negation, etc. This should be called from within an init().
func RegisterWindowFunction ¶ added in v0.57.1
func RegisterWindowFunction(f WindowFunctionInterface)
RegisterWindowFunction registers the given window-only function, so that it will be usable from a running server. This should be called from within an init().
func ReplaceFunctionColumn ¶ added in v0.52.1
func ReplaceFunctionColumn(parsedAST tree.Statement, params map[string]*ParamTypAndValue) error
ReplaceFunctionColumn parses and replaces UnresolvedName and Placeholder expressions with FunctionColumn expression containing parameter type and arguments if applicable. It also replaces empty parameter name with binding variable name to match the name used in FunctionColumn. This function should be used for FUNCTION with SQL language statements only.
func ReplaceUnresolvedToFunctionColumn ¶ added in v0.52.1
func ReplaceUnresolvedToFunctionColumn(paramMap map[string]*ParamTypAndValue, expr tree.Expr) tree.Expr
ReplaceUnresolvedToFunctionColumn replaces Placeholder and UnresolvedName expressions with FunctionColumn containing parameter type and argument value if applicable when the name of expression matches function parameter.
Types ¶
type AggregateFunction ¶ added in v0.51.0
type AggregateFunction interface {
sql.FunctionExpression
sql.Aggregation
// contains filtered or unexported methods
}
AggregateFunction is an expression that represents CompiledAggregateFunction
type AggregateFunctionInterface ¶ added in v0.51.0
type AggregateFunctionInterface interface {
FunctionInterface
// TODO: this maybe needs to take the place of the Callable function
NewBuffer([]sql.Expression) (sql.AggregationBuffer, error)
// NewWindowFunc returns the constructor used to build this aggregate's runtime sql.WindowFunction for use
// within an OVER(...) clause, or nil if this aggregate does not yet support window use.
NewWindowFunc() NewWindowFunctionFn
}
AggregateFunctionInterface is an interface for PostgreSQL aggregate functions
type CompiledAggregateFunction ¶ added in v0.51.0
type CompiledAggregateFunction struct {
*CompiledFunction
// contains filtered or unexported fields
}
CompiledAggregateFunction is an expression that represents a fully-analyzed PostgreSQL aggregate function.
func NewCompiledAggregateFunction ¶ added in v0.51.0
func NewCompiledAggregateFunction(ctx *sql.Context, name string, args []sql.Expression, functions *Overloads) *CompiledAggregateFunction
NewCompiledAggregateFunction returns a newly compiled function.
func (*CompiledAggregateFunction) Children ¶ added in v0.57.1
func (c *CompiledAggregateFunction) Children() []sql.Expression
Children implements the interface sql.Expression. When this aggregate is bound to a window (via WithWindow), the window's PartitionBy/OrderBy expressions are included after the aggregate's own arguments, mirroring GMS's own unaryAggBase.Children(): analyzer passes such as column pruning only discover a node's column dependencies by walking Children(), and window.PartitionBy/OrderBy are otherwise invisible to them since they aren't part of Arguments.
func (*CompiledAggregateFunction) DebugString ¶ added in v0.51.0
func (c *CompiledAggregateFunction) DebugString(ctx *sql.Context) string
func (*CompiledAggregateFunction) Eval ¶ added in v0.51.0
Eval implements the interface sql.Expression.
func (*CompiledAggregateFunction) Id ¶ added in v0.51.0
func (c *CompiledAggregateFunction) Id() sql.ColumnId
Id implements the interface sql.Aggregation.
func (*CompiledAggregateFunction) NewBuffer ¶ added in v0.51.0
func (c *CompiledAggregateFunction) NewBuffer(ctx *sql.Context) (sql.AggregationBuffer, error)
NewBuffer implements the interface sql.Aggregation.
func (*CompiledAggregateFunction) NewWindowFunction ¶ added in v0.51.0
func (c *CompiledAggregateFunction) NewWindowFunction(ctx *sql.Context) (sql.WindowFunction, error)
NewWindowFunction implements the interface sql.WindowAdaptableExpression.
func (*CompiledAggregateFunction) SetStatementRunner ¶ added in v0.51.0
func (c *CompiledAggregateFunction) SetStatementRunner(ctx *sql.Context, runner sql.StatementRunner) sql.Expression
SetStatementRunner implements the interface analyzer.Interpreter.
func (*CompiledAggregateFunction) String ¶ added in v1.0.0
func (c *CompiledAggregateFunction) String() string
String implements the interface sql.Expression. This must include the bound window/OVER clause (not just the function name and arguments, which is all CompiledFunction.String() returns): GMS's planbuilder deduplicates the window select-list by this string (see buildWindow in sql/planbuilder/aggregates.go), so two calls to the same aggregate that differ only in their OVER clause (partition/order/frame) would otherwise collide and silently collapse into a single computed column.
func (*CompiledAggregateFunction) Window ¶ added in v0.51.0
func (c *CompiledAggregateFunction) Window() *sql.WindowDefinition
Window implements the interface sql.WindowAdaptableExpression.
func (*CompiledAggregateFunction) WithChildren ¶ added in v0.51.0
func (c *CompiledAggregateFunction) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
WithChildren implements the interface sql.Expression.
func (*CompiledAggregateFunction) WithId ¶ added in v0.51.0
func (c *CompiledAggregateFunction) WithId(id sql.ColumnId) sql.IdExpression
WithId implements the interface sql.Aggregation.
func (*CompiledAggregateFunction) WithWindow ¶ added in v0.51.0
func (c *CompiledAggregateFunction) WithWindow(ctx *sql.Context, window *sql.WindowDefinition) sql.WindowAdaptableExpression
WithWindow implements the interface sql.WindowAdaptableExpression.
type CompiledFunction ¶
type CompiledFunction struct {
Name string
Arguments []sql.Expression
IsOperator bool
// contains filtered or unexported fields
}
CompiledFunction is an expression that represents a fully-analyzed PostgreSQL function.
func GetFunction ¶ added in v0.8.0
func GetFunction(ctx *sql.Context, functionName string, params ...sql.Expression) (*CompiledFunction, bool, error)
GetFunction returns the compiled function with the given name and parameters. Returns false if the function could not be found.
func NewCompiledFunction ¶ added in v0.9.0
func NewCompiledFunction(ctx *sql.Context, name string, args []sql.Expression, functions *Overloads, isOperator bool) *CompiledFunction
NewCompiledFunction returns a newly compiled function.
func (*CompiledFunction) Children ¶
func (c *CompiledFunction) Children() []sql.Expression
Children implements the interface sql.Expression.
func (*CompiledFunction) Description ¶
func (c *CompiledFunction) Description() string
Description implements the interface sql.Expression.
func (*CompiledFunction) EvalRowIter ¶ added in v0.51.0
EvalRowIter implements sql.RowIterExpression
func (*CompiledFunction) FunctionName ¶
func (c *CompiledFunction) FunctionName() string
FunctionName implements the interface sql.Expression.
func (*CompiledFunction) GetQuickFunction ¶ added in v0.16.0
func (c *CompiledFunction) GetQuickFunction(ctx *sql.Context) QuickFunction
GetQuickFunction returns the QuickFunction form of this function, if it exists. If one does not exist, then this return nil.
func (*CompiledFunction) IsNonDeterministic ¶ added in v0.8.0
func (c *CompiledFunction) IsNonDeterministic() bool
IsNonDeterministic implements the interface sql.NonDeterministicExpression.
func (*CompiledFunction) IsNullable ¶
func (c *CompiledFunction) IsNullable(ctx *sql.Context) bool
IsNullable implements the interface sql.Expression.
func (*CompiledFunction) IsSRF ¶ added in v0.51.0
func (c *CompiledFunction) IsSRF() bool
IsSRF returns whether this function is a set returning function.
func (*CompiledFunction) IsStrict ¶ added in v0.56.5
func (c *CompiledFunction) IsStrict() bool
IsStrict returns whether this function has the STRICT property regarding nulls.
func (*CompiledFunction) IsVariadic ¶ added in v0.16.0
func (c *CompiledFunction) IsVariadic() bool
IsVariadic returns whether this function has any variadic parameters.
func (*CompiledFunction) OutParametersSchema ¶ added in v0.57.3
func (c *CompiledFunction) OutParametersSchema() sql.Schema
OutParametersSchema implements the interface sql.ExtendedTableFunction.
func (*CompiledFunction) OverloadString ¶
func (c *CompiledFunction) OverloadString(types []*pgtypes.DoltgresType) string
OverloadString returns the name of the function represented by the given overload.
func (*CompiledFunction) ResolveDefaultValues ¶ added in v0.56.1
func (c *CompiledFunction) ResolveDefaultValues(ctx *sql.Context, getDefExpr func(defExpr string) (sql.Expression, error)) error
ResolveDefaultValues adds missing arguments if there is any using the default value set on the parameter. It checks if it's a valid SQL function that has fewer arguments than defined parameters.
func (*CompiledFunction) Resolved ¶
func (c *CompiledFunction) Resolved() bool
Resolved implements the interface sql.Expression.
func (*CompiledFunction) ReturnsRowIter ¶ added in v0.51.0
func (c *CompiledFunction) ReturnsRowIter() bool
ReturnsRowIter implements the interface sql.RowIterExpression
func (*CompiledFunction) SetStatementRunner ¶ added in v0.17.0
func (c *CompiledFunction) SetStatementRunner(ctx *sql.Context, runner sql.StatementRunner) sql.Expression
SetStatementRunner implements the interface analyzer.Interpreter.
func (*CompiledFunction) StashedError ¶ added in v0.12.0
func (c *CompiledFunction) StashedError() error
StashedError returns the stashed error if one exists. Otherwise, returns nil.
func (*CompiledFunction) String ¶
func (c *CompiledFunction) String() string
String implements the interface sql.Expression.
func (*CompiledFunction) Type ¶
func (c *CompiledFunction) Type(ctx *sql.Context) sql.Type
Type implements the interface sql.Expression.
func (*CompiledFunction) Unwrap ¶ added in v0.57.3
func (c *CompiledFunction) Unwrap(v any) sql.Row
Unwrap implements the interface sql.ExtendedTableFunction.
func (*CompiledFunction) WithChildren ¶
func (c *CompiledFunction) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
WithChildren implements the interface sql.Expression.
type CompiledWindowFunction ¶ added in v0.57.1
type CompiledWindowFunction struct {
*CompiledFunction
// contains filtered or unexported fields
}
CompiledWindowFunction is an expression that represents a fully-analyzed PostgreSQL window-only function.
func NewCompiledWindowFunction ¶ added in v0.57.1
func NewCompiledWindowFunction(ctx *sql.Context, name string, args []sql.Expression, functions *Overloads) *CompiledWindowFunction
NewCompiledWindowFunction returns a newly compiled function.
func (*CompiledWindowFunction) Children ¶ added in v0.57.1
func (c *CompiledWindowFunction) Children() []sql.Expression
Children implements the interface sql.Expression. When this function is bound to a window (via WithWindow), the window's PartitionBy/OrderBy expressions are included after its own arguments, mirroring GMS's own unaryAggBase.Children(): analyzer passes such as column pruning only discover a node's column dependencies by walking Children(), and window.PartitionBy/OrderBy are otherwise invisible to them since they aren't part of Arguments.
func (*CompiledWindowFunction) DebugString ¶ added in v0.57.1
func (c *CompiledWindowFunction) DebugString(ctx *sql.Context) string
func (*CompiledWindowFunction) Eval ¶ added in v0.57.1
Eval implements the interface sql.Expression.
func (*CompiledWindowFunction) Id ¶ added in v0.57.1
func (c *CompiledWindowFunction) Id() sql.ColumnId
Id implements the interface sql.IdExpression.
func (*CompiledWindowFunction) NewWindowFunction ¶ added in v0.57.1
func (c *CompiledWindowFunction) NewWindowFunction(ctx *sql.Context) (sql.WindowFunction, error)
NewWindowFunction implements the interface sql.WindowAdaptableExpression.
func (*CompiledWindowFunction) SetStatementRunner ¶ added in v0.57.1
func (c *CompiledWindowFunction) SetStatementRunner(ctx *sql.Context, runner sql.StatementRunner) sql.Expression
SetStatementRunner implements the interface analyzer.Interpreter.
func (*CompiledWindowFunction) String ¶ added in v1.0.0
func (c *CompiledWindowFunction) String() string
String implements the interface sql.Expression. This must include the bound window/OVER clause (not just the function name and arguments, which is all CompiledFunction.String() returns): GMS's planbuilder deduplicates the window select-list by this string (see buildWindow in sql/planbuilder/aggregates.go), so two calls to the same window-only function that differ only in their OVER clause would otherwise collide and silently collapse into a single computed column.
func (*CompiledWindowFunction) Window ¶ added in v0.57.1
func (c *CompiledWindowFunction) Window() *sql.WindowDefinition
Window implements the interface sql.WindowAdaptableExpression.
func (*CompiledWindowFunction) WithChildren ¶ added in v0.57.1
func (c *CompiledWindowFunction) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
WithChildren implements the interface sql.Expression.
func (*CompiledWindowFunction) WithId ¶ added in v0.57.1
func (c *CompiledWindowFunction) WithId(id sql.ColumnId) sql.IdExpression
WithId implements the interface sql.IdExpression.
func (*CompiledWindowFunction) WithWindow ¶ added in v0.57.1
func (c *CompiledWindowFunction) WithWindow(ctx *sql.Context, window *sql.WindowDefinition) sql.WindowAdaptableExpression
WithWindow implements the interface sql.WindowAdaptableExpression.
type ExtensionFunction ¶ added in v1.0.0
type ExtensionFunction struct {
ID id.Function
ReturnType *pgtypes.DoltgresType
ParameterTypes []*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SetOf bool
ExtensionName string
ExtensionSymbol string
}
ExtensionFunction is the implementation of functions that an extension provides, looked up in server/extensions by extension name and symbol.
func (ExtensionFunction) GetExpectedParameterCount ¶ added in v1.0.0
func (extFunc ExtensionFunction) GetExpectedParameterCount() int
GetExpectedParameterCount implements the interface FunctionInterface.
func (ExtensionFunction) GetInputParameterTypes ¶ added in v1.0.0
func (extFunc ExtensionFunction) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the interface FunctionInterface.
func (ExtensionFunction) GetName ¶ added in v1.0.0
func (extFunc ExtensionFunction) GetName() string
GetName implements the interface FunctionInterface.
func (ExtensionFunction) GetOutParameters ¶ added in v1.0.0
func (extFunc ExtensionFunction) GetOutParameters() sql.Schema
GetOutParameters implements the interface FunctionInterface.
func (ExtensionFunction) GetReturn ¶ added in v1.0.0
func (extFunc ExtensionFunction) GetReturn() *pgtypes.DoltgresType
GetReturn implements the interface FunctionInterface.
func (ExtensionFunction) InternalID ¶ added in v1.0.0
func (extFunc ExtensionFunction) InternalID() id.Id
InternalID implements the interface FunctionInterface.
func (ExtensionFunction) IsCVariadic ¶ added in v1.0.0
func (extFunc ExtensionFunction) IsCVariadic() bool
IsCVariadic implements the FunctionInterface interface.
func (ExtensionFunction) IsSRF ¶ added in v1.0.0
func (extFunc ExtensionFunction) IsSRF() bool
IsSRF implements the interface FunctionInterface.
func (ExtensionFunction) IsStrict ¶ added in v1.0.0
func (extFunc ExtensionFunction) IsStrict() bool
IsStrict implements the interface FunctionInterface.
func (ExtensionFunction) NonDeterministic ¶ added in v1.0.0
func (extFunc ExtensionFunction) NonDeterministic() bool
NonDeterministic implements the interface FunctionInterface.
func (ExtensionFunction) VariadicIndex ¶ added in v1.0.0
func (extFunc ExtensionFunction) VariadicIndex() int
VariadicIndex implements the interface FunctionInterface.
type Func0Window ¶ added in v0.57.1
type Func0Window struct {
Function0
NewWinFunc func(window *sql.WindowDefinition) (sql.WindowFunction, error)
}
Func0Window is a PostgreSQL function that takes no parameters and may only be used as a window function (within an OVER(...) clause), such as row_number().
func (Func0Window) NewWindowFunc ¶ added in v0.57.1
func (f Func0Window) NewWindowFunc() NewWindowFunctionFn
type Func1Aggregate ¶ added in v0.51.0
type Func1Aggregate struct {
Function1
NewAggBuffer func([]sql.Expression) (sql.AggregationBuffer, error)
// NewAggWindowFunc optionally builds this aggregate's runtime sql.WindowFunction for use within an
// OVER(...) clause. Leave nil if this aggregate does not yet support window use.
NewAggWindowFunc NewWindowFunctionFn
}
Func1Aggregate is a function that takes one parameter and is an aggregate function.
func (Func1Aggregate) NewBuffer ¶ added in v0.51.0
func (f Func1Aggregate) NewBuffer(exprs []sql.Expression) (sql.AggregationBuffer, error)
func (Func1Aggregate) NewWindowFunc ¶ added in v0.57.1
func (f Func1Aggregate) NewWindowFunc() NewWindowFunctionFn
type Func1Window ¶ added in v1.0.0
type Func1Window struct {
Function1
NewWinFunc NewWindowFunctionFn
}
Func1Window is a PostgreSQL function that takes one parameter and may only be used as a window function (within an OVER(...) clause), such as ntile().
func (Func1Window) NewWindowFunc ¶ added in v1.0.0
func (f Func1Window) NewWindowFunc() NewWindowFunctionFn
type Func2Window ¶ added in v1.0.0
type Func2Window struct {
Function2
NewWinFunc NewWindowFunctionFn
}
Func2Window is a PostgreSQL function that takes two parameters and may only be used as a window function (within an OVER(...) clause), such as nth_value().
func (Func2Window) NewWindowFunc ¶ added in v1.0.0
func (f Func2Window) NewWindowFunc() NewWindowFunctionFn
type Function ¶
type Function interface {
sql.FunctionExpression
sql.NonDeterministicExpression
// contains filtered or unexported methods
}
Function is an expression that represents either a CompiledFunction or a QuickFunction.
func GetUserFunction ¶ added in v1.2.0
func GetUserFunction(ctx *sql.Context, schemaName string, functionName string, args ...sql.Expression) (Function, error)
GetUserFunction returns the compiled call to the named function with the given argument expressions. Returns nil if the function does not exist.
type Function0 ¶
type Function0 struct {
Name string
Return *pgtypes.DoltgresType
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context) (any, error)
OutParams sql.Schema // name and type, potentially default?
}
Function0 is a function that does not take any parameters.
func (Function0) GetExpectedParameterCount ¶
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function0) GetInputParameterTypes ¶ added in v0.57.3
func (f Function0) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function0) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function0) GetReturn ¶
func (f Function0) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function0) InternalID ¶ added in v0.16.0
InternalID implements the FunctionInterface interface.
func (Function0) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function0) NonDeterministic ¶ added in v0.11.0
NonDeterministic implements the FunctionInterface interface.
func (Function0) VariadicIndex ¶ added in v0.11.0
type Function1 ¶
type Function1 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [1]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [2]*pgtypes.DoltgresType, val1 any) (any, error)
OutParams sql.Schema // name and type, potentially default?
}
Function1 is a function that takes one parameter. The parameter and return type is passed into the Callable function when the parameter (and possibly return type) is a polymorphic type. The return type is the last type in the array.
func (Function1) GetExpectedParameterCount ¶
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function1) GetInputParameterTypes ¶ added in v0.57.3
func (f Function1) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function1) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function1) GetReturn ¶
func (f Function1) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function1) InternalID ¶ added in v0.16.0
InternalID implements the FunctionInterface interface.
func (Function1) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function1) NonDeterministic ¶ added in v0.11.0
NonDeterministic implements the FunctionInterface interface.
func (Function1) VariadicIndex ¶ added in v0.11.0
VariadicIndex implements the FunctionInterface interface.
type Function1N ¶ added in v0.56.1
type Function1N struct {
Name string
Return *pgtypes.DoltgresType
Parameters [1]*pgtypes.DoltgresType
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn []*pgtypes.DoltgresType, val1 any, vals []any) (any, error)
}
Function1N is a function that takes at least one parameter. This is different from a SQL variadic function, as the additional parameters may have different types (that do not contribute to type deduction like with `anyelement`), and is only usable by C-language functions (notably built-in ones such as `concat`). The field `paramsAndReturn` works similarly to standard functions, with the last type being the return type.
func (Function1N) GetExpectedParameterCount ¶ added in v0.56.1
func (f Function1N) GetExpectedParameterCount() int
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function1N) GetInputParameterTypes ¶ added in v0.57.3
func (f Function1N) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function1N) GetName ¶ added in v0.56.1
func (f Function1N) GetName() string
GetName implements the FunctionInterface interface.
func (Function1N) GetOutParameters ¶ added in v0.57.3
func (f Function1N) GetOutParameters() sql.Schema
GetOutParameters implements the FunctionInterface interface.
func (Function1N) GetReturn ¶ added in v0.56.1
func (f Function1N) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function1N) InternalID ¶ added in v0.56.1
func (f Function1N) InternalID() id.Id
InternalID implements the FunctionInterface interface.
func (Function1N) IsCVariadic ¶ added in v0.56.1
func (f Function1N) IsCVariadic() bool
IsCVariadic implements the FunctionInterface interface.
func (Function1N) IsSRF ¶ added in v0.56.1
func (f Function1N) IsSRF() bool
IsSRF implements the FunctionInterface interface.
func (Function1N) IsStrict ¶ added in v0.56.1
func (f Function1N) IsStrict() bool
IsStrict implements the FunctionInterface interface.
func (Function1N) NonDeterministic ¶ added in v0.56.1
func (f Function1N) NonDeterministic() bool
NonDeterministic implements the FunctionInterface interface.
func (Function1N) VariadicIndex ¶ added in v0.56.1
func (f Function1N) VariadicIndex() int
VariadicIndex implements the FunctionInterface interface.
type Function2 ¶
type Function2 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [2]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [3]*pgtypes.DoltgresType, val1 any, val2 any) (any, error)
OutParams sql.Schema // name and type, potentially default?
}
Function2 is a function that takes two parameters. The parameter and return types are passed into the Callable function when the parameters (and possibly return type) have at least one polymorphic type. The return type is the last type in the array.
func (Function2) GetExpectedParameterCount ¶
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function2) GetInputParameterTypes ¶ added in v0.57.3
func (f Function2) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function2) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function2) GetReturn ¶
func (f Function2) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function2) InternalID ¶ added in v0.16.0
InternalID implements the FunctionInterface interface.
func (Function2) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function2) NonDeterministic ¶ added in v0.11.0
NonDeterministic implements the FunctionInterface interface.
func (Function2) VariadicIndex ¶ added in v0.11.0
VariadicIndex implements the FunctionInterface interface.
type Function2N ¶ added in v0.56.1
type Function2N struct {
Name string
Return *pgtypes.DoltgresType
Parameters [2]*pgtypes.DoltgresType
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn []*pgtypes.DoltgresType, val1 any, val2 any, vals []any) (any, error)
}
Function2N is a function that takes at least two parameters. This is different from a SQL variadic function, as the additional parameters may have different types (that do not contribute to type deduction like with `anyelement`), and is only usable by C-language functions (notably built-in ones such as `concat_ws`). The field `paramsAndReturn` works similarly to standard functions, with the last type being the return type.
func (Function2N) GetExpectedParameterCount ¶ added in v0.56.1
func (f Function2N) GetExpectedParameterCount() int
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function2N) GetInputParameterTypes ¶ added in v0.57.3
func (f Function2N) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function2N) GetName ¶ added in v0.56.1
func (f Function2N) GetName() string
GetName implements the FunctionInterface interface.
func (Function2N) GetOutParameters ¶ added in v0.57.3
func (f Function2N) GetOutParameters() sql.Schema
GetOutParameters implements the FunctionInterface interface.
func (Function2N) GetReturn ¶ added in v0.56.1
func (f Function2N) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function2N) InternalID ¶ added in v0.56.1
func (f Function2N) InternalID() id.Id
InternalID implements the FunctionInterface interface.
func (Function2N) IsCVariadic ¶ added in v0.56.1
func (f Function2N) IsCVariadic() bool
IsCVariadic implements the FunctionInterface interface.
func (Function2N) IsSRF ¶ added in v0.56.1
func (f Function2N) IsSRF() bool
IsSRF implements the FunctionInterface interface.
func (Function2N) IsStrict ¶ added in v0.56.1
func (f Function2N) IsStrict() bool
IsStrict implements the FunctionInterface interface.
func (Function2N) NonDeterministic ¶ added in v0.56.1
func (f Function2N) NonDeterministic() bool
NonDeterministic implements the FunctionInterface interface.
func (Function2N) VariadicIndex ¶ added in v0.56.1
func (f Function2N) VariadicIndex() int
VariadicIndex implements the FunctionInterface interface.
type Function3 ¶
type Function3 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [3]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [4]*pgtypes.DoltgresType, val1 any, val2 any, val3 any) (any, error)
}
Function3 is a function that takes three parameters. The parameter and return types are passed into the Callable function when the parameters (and possibly return type) have at least one polymorphic type. The return type is the last type in the array.
func (Function3) GetExpectedParameterCount ¶
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function3) GetInputParameterTypes ¶ added in v0.57.3
func (f Function3) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function3) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function3) GetReturn ¶
func (f Function3) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function3) InternalID ¶ added in v0.16.0
InternalID implements the FunctionInterface interface.
func (Function3) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function3) NonDeterministic ¶ added in v0.11.0
NonDeterministic implements the FunctionInterface interface.
func (Function3) VariadicIndex ¶ added in v0.11.0
VariadicIndex implements the FunctionInterface interface.
type Function4 ¶
type Function4 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [4]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [5]*pgtypes.DoltgresType, val1 any, val2 any, val3 any, val4 any) (any, error)
}
Function4 is a function that takes four parameters. The parameter and return types are passed into the Callable function when the parameters (and possibly return type) have at least one polymorphic type. The return type is the last type in the array.
func (Function4) GetExpectedParameterCount ¶
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function4) GetInputParameterTypes ¶ added in v0.57.3
func (f Function4) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function4) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function4) GetReturn ¶
func (f Function4) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function4) InternalID ¶ added in v0.16.0
InternalID implements the FunctionInterface interface.
func (Function4) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function4) NonDeterministic ¶ added in v0.11.0
NonDeterministic implements the FunctionInterface interface.
func (Function4) VariadicIndex ¶ added in v0.11.0
VariadicIndex implements the FunctionInterface interface.
type Function5 ¶ added in v0.52.0
type Function5 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [5]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [6]*pgtypes.DoltgresType, val1 any, val2 any, val3 any, val4 any, val5 any) (any, error)
}
Function5 is a function that takes five parameters. The parameter and return types are passed into the Callable function when the parameters (and possibly return type) have at least one polymorphic type. The return type is the last type in the array.
func (Function5) GetExpectedParameterCount ¶ added in v0.52.0
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function5) GetInputParameterTypes ¶ added in v0.57.3
func (f Function5) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function5) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function5) GetReturn ¶ added in v0.52.0
func (f Function5) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function5) InternalID ¶ added in v0.52.0
InternalID implements the FunctionInterface interface.
func (Function5) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function5) NonDeterministic ¶ added in v0.52.0
NonDeterministic implements the FunctionInterface interface.
func (Function5) VariadicIndex ¶ added in v0.52.0
VariadicIndex implements the FunctionInterface interface.
type Function6 ¶ added in v0.52.0
type Function6 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [6]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [7]*pgtypes.DoltgresType, val1 any, val2 any, val3 any, val4 any, val5 any, val6 any) (any, error)
}
Function6 is a function that takes six parameters. The parameter and return types are passed into the Callable function when the parameters (and possibly return type) have at least one polymorphic type. The return type is the last type in the array.
func (Function6) GetExpectedParameterCount ¶ added in v0.52.0
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function6) GetInputParameterTypes ¶ added in v0.57.3
func (f Function6) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function6) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function6) GetReturn ¶ added in v0.52.0
func (f Function6) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function6) InternalID ¶ added in v0.52.0
InternalID implements the FunctionInterface interface.
func (Function6) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function6) NonDeterministic ¶ added in v0.52.0
NonDeterministic implements the FunctionInterface interface.
func (Function6) VariadicIndex ¶ added in v0.52.0
VariadicIndex implements the FunctionInterface interface.
type Function7 ¶ added in v0.52.0
type Function7 struct {
Name string
Return *pgtypes.DoltgresType
Parameters [7]*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Callable func(ctx *sql.Context, paramsAndReturn [8]*pgtypes.DoltgresType, val1 any, val2 any, val3 any, val4 any, val5 any, val6 any, val7 any) (any, error)
}
Function7 is a function that takes seven parameters. The parameter and return types are passed into the Callable function when the parameters (and possibly return type) have at least one polymorphic type. The return type is the last type in the array.
func (Function7) GetExpectedParameterCount ¶ added in v0.52.0
GetExpectedParameterCount implements the FunctionInterface interface.
func (Function7) GetInputParameterTypes ¶ added in v0.57.3
func (f Function7) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the FunctionInterface interface.
func (Function7) GetOutParameters ¶ added in v0.57.3
GetOutParameters implements the FunctionInterface interface.
func (Function7) GetReturn ¶ added in v0.52.0
func (f Function7) GetReturn() *pgtypes.DoltgresType
GetReturn implements the FunctionInterface interface.
func (Function7) InternalID ¶ added in v0.52.0
InternalID implements the FunctionInterface interface.
func (Function7) IsCVariadic ¶ added in v0.56.1
IsCVariadic implements the FunctionInterface interface.
func (Function7) NonDeterministic ¶ added in v0.52.0
NonDeterministic implements the FunctionInterface interface.
func (Function7) VariadicIndex ¶ added in v0.52.0
VariadicIndex implements the FunctionInterface interface.
type FunctionInterface ¶
type FunctionInterface interface {
// GetName returns the name of the function. The name is case-insensitive, so the casing does not matter.
GetName() string
// GetOutParameters returns sql.Schema of output parameter with names and types.
GetOutParameters() sql.Schema
// GetReturn returns the return type.
GetReturn() *pgtypes.DoltgresType
// GetInputParameterTypes returns the parameter types for the function.
GetInputParameterTypes() []*pgtypes.DoltgresType
// VariadicIndex returns the index of the variadic parameter, if it exists, or -1 otherwise
VariadicIndex() int
// GetExpectedParameterCount returns the number of input parameters that are valid for this function.
GetExpectedParameterCount() int
// NonDeterministic returns whether the function is non-deterministic.
NonDeterministic() bool
// IsCVariadic returns whether this function uses a variadic form restricted to C-language functions.
// https://www.postgresql.org/docs/15/xfunc-c.html#id-1.8.3.13.13
IsCVariadic() bool
// IsStrict returns whether the function is STRICT, which means if any parameter is NULL, then it returns NULL.
// Otherwise, if it's not, the NULL input must be handled by user.
IsStrict() bool
// IsSRF returns whether the function is a set returning function, meaning whether the
// function returns one or more rows as a result.
IsSRF() bool
// InternalID returns the ID associated with this function.
InternalID() id.Id
// contains filtered or unexported methods
}
FunctionInterface is an interface for PostgreSQL functions.
type FunctionProvider ¶ added in v0.17.0
type FunctionProvider struct{}
FunctionProvider is the special sql.FunctionProvider for Doltgres that allows us to handle functions that are created by users.
type IntermediateFunction ¶
IntermediateFunction is an expression that represents an incomplete PostgreSQL function.
func GetBinaryFunction ¶
func GetBinaryFunction(operator Operator) IntermediateFunction
GetBinaryFunction returns the binary function that matches the given operator.
func GetUnaryFunction ¶
func GetUnaryFunction(operator Operator) IntermediateFunction
GetUnaryFunction returns the unary function that matches the given operator.
func (IntermediateFunction) Compile ¶
func (f IntermediateFunction) Compile(ctx *sql.Context, name string, parameters ...sql.Expression) *CompiledFunction
Compile returns a CompiledFunction created from the calling IntermediateFunction. Returns a nil function if it could not be compiled.
type InterpretedFunction ¶ added in v0.17.0
type InterpretedFunction struct {
ID id.Function
ReturnType *pgtypes.DoltgresType
AllParams []procedures.Parameter
AllTypes []*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SRF bool
Statements []plpgsql.InterpreterOperation
}
InterpretedFunction is the implementation of functions created using PL/pgSQL. The created functions are converted to a collection of operations, and an interpreter iterates over those operations to handle the logic.
func (InterpretedFunction) ApplyBindings ¶ added in v0.52.3
func (InterpretedFunction) ApplyBindings(ctx *sql.Context, stack plpgsql.InterpreterStack, stmt string, bindings []string, enforceType bool) (newStmt string, varFound bool, err error)
ApplyBindings applies the given bindings to the statement. If `varFound` is false, then the error will state that the variable was not found (which means the error may be ignored if you're only concerned with finding a variable). If `varFound` is true, then the error is related to formatting the variable. `enforceType` adds casting and quotes to ensure that the value is correctly represented in the string.
func (InterpretedFunction) GetAllNames ¶ added in v0.57.3
func (iFunc InterpretedFunction) GetAllNames() []string
GetAllNames implements the interface InterpretedFunction.
func (InterpretedFunction) GetExpectedParameterCount ¶ added in v0.17.0
func (iFunc InterpretedFunction) GetExpectedParameterCount() int
GetExpectedParameterCount implements the interface FunctionInterface.
func (InterpretedFunction) GetInputParameterNamesAndTypes ¶ added in v0.57.3
func (iFunc InterpretedFunction) GetInputParameterNamesAndTypes() ([]string, []*pgtypes.DoltgresType)
GetInputParameterNamesAndTypes implements the interface InterpretedFunction.
func (InterpretedFunction) GetInputParameterTypes ¶ added in v0.57.3
func (iFunc InterpretedFunction) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the interface FunctionInterface.
func (InterpretedFunction) GetName ¶ added in v0.17.0
func (iFunc InterpretedFunction) GetName() string
GetName implements the interface FunctionInterface.
func (InterpretedFunction) GetOutParameters ¶ added in v0.57.3
func (iFunc InterpretedFunction) GetOutParameters() sql.Schema
GetOutParameters implements the interface FunctionInterface.
func (InterpretedFunction) GetOutputParameterNamesAndTypes ¶ added in v0.57.3
func (iFunc InterpretedFunction) GetOutputParameterNamesAndTypes() ([]string, []*pgtypes.DoltgresType)
GetOutputParameterNamesAndTypes implements the interface InterpretedFunction.
func (InterpretedFunction) GetReturn ¶ added in v0.17.0
func (iFunc InterpretedFunction) GetReturn() *pgtypes.DoltgresType
GetReturn implements the interface FunctionInterface.
func (InterpretedFunction) GetStatements ¶ added in v0.17.0
func (iFunc InterpretedFunction) GetStatements() []plpgsql.InterpreterOperation
GetStatements returns the contained statements.
func (InterpretedFunction) InternalID ¶ added in v0.17.0
func (iFunc InterpretedFunction) InternalID() id.Id
InternalID implements the interface FunctionInterface.
func (InterpretedFunction) IsCVariadic ¶ added in v0.56.1
func (iFunc InterpretedFunction) IsCVariadic() bool
IsCVariadic implements the FunctionInterface interface.
func (InterpretedFunction) IsSRF ¶ added in v0.51.0
func (iFunc InterpretedFunction) IsSRF() bool
IsSRF implements the interface FunctionInterface.
func (InterpretedFunction) IsStrict ¶ added in v0.17.0
func (iFunc InterpretedFunction) IsStrict() bool
IsStrict implements the interface FunctionInterface.
func (InterpretedFunction) NonDeterministic ¶ added in v0.17.0
func (iFunc InterpretedFunction) NonDeterministic() bool
NonDeterministic implements the interface FunctionInterface.
func (InterpretedFunction) QueryMultiReturn ¶ added in v0.17.0
func (iFunc InterpretedFunction) QueryMultiReturn(ctx *sql.Context, stack plpgsql.InterpreterStack, stmt string, bindings []string) (schema sql.Schema, rows []sql.Row, err error)
QueryMultiReturn handles queries that may return multiple values over multiple rows.
func (InterpretedFunction) QuerySingleReturn ¶ added in v0.17.0
func (iFunc InterpretedFunction) QuerySingleReturn(ctx *sql.Context, stack plpgsql.InterpreterStack, stmt string, targetType *pgtypes.DoltgresType, bindings []string) (val any, err error)
QuerySingleReturn handles queries that are supposed to return a single value.
func (InterpretedFunction) VariadicIndex ¶ added in v0.17.0
func (iFunc InterpretedFunction) VariadicIndex() int
VariadicIndex implements the interface FunctionInterface.
type NewBufferFn ¶ added in v0.51.0
type NewBufferFn func([]sql.Expression) (sql.AggregationBuffer, error)
type NewWindowFunctionFn ¶ added in v0.57.1
type NewWindowFunctionFn func(exprs []sql.Expression, window *sql.WindowDefinition) (sql.WindowFunction, error)
NewWindowFunctionFn creates a sql.WindowFunction for the given arguments, for use within an OVER(...) clause bound to the given window definition.
type Operator ¶
type Operator byte
Operator is a unary or binary operator.
const ( Operator_BinaryPlus Operator = iota // + Operator_BinaryMinus // - Operator_BinaryMultiply // * Operator_BinaryDivide // / Operator_BinaryMod // % Operator_BinaryShiftLeft // << Operator_BinaryShiftRight // >> Operator_BinaryLessThan // < Operator_BinaryGreaterThan // > Operator_BinaryLessOrEqual // <= Operator_BinaryGreaterOrEqual // >= Operator_BinaryEqual // = Operator_BinaryNotEqual // <> or != (they're equivalent in all cases) Operator_BinaryBitAnd // & Operator_BinaryBitOr // | Operator_BinaryBitXor // ^ Operator_BinaryConcatenate // || Operator_BinaryJSONExtractJson // -> Operator_BinaryJSONExtractText // ->> Operator_BinaryJSONExtractPathJson // #> Operator_BinaryJSONExtractPathText // #>> Operator_BinaryJSONContainsRight // @> Operator_BinaryJSONContainsLeft // <@ Operator_BinaryJSONTopLevel // ? Operator_BinaryJSONTopLevelAny // ?| Operator_BinaryJSONTopLevelAll // ?& Operator_BinaryL2Distance // <-> Operator_BinaryL1Distance // <+> Operator_BinaryCosineDistance // <=> Operator_BinaryNegInnerProduct // <#> Operator_BinaryJaccardDistance // <%> Operator_BinaryHammingDistance // <~> Operator_UnaryPlus // + Operator_UnaryMinus // - )
func GetOperatorFromString ¶ added in v0.11.0
GetOperatorFromString returns the binary operator for the given subOperator.
type Overload ¶ added in v0.11.0
type Overload struct {
// contains filtered or unexported fields
}
Overload is a single overload of a given function, used during evaluation to match the arguments provided to a particular overload.
type Overloads ¶ added in v0.11.0
type Overloads struct {
// ByParamType contains all overloads for the function with this name, indexed by the key of the parameter types.
ByParamType map[string]FunctionInterface
// AllOverloads contains all overloads for the function with this name
AllOverloads []FunctionInterface
}
Overloads is the collection of all overloads for a given function name.
func NewOverloads ¶ added in v0.11.0
func NewOverloads() *Overloads
NewOverloads creates a new empty overload collection.
func (*Overloads) Add ¶ added in v0.11.0
func (o *Overloads) Add(function FunctionInterface) error
Add adds the given function to the overload collection. Returns an error if the there's a problem with the function's declaration.
func (*Overloads) ExactMatchForTypes ¶ added in v0.11.0
func (o *Overloads) ExactMatchForTypes(types ...*pgtypes.DoltgresType) (FunctionInterface, bool)
ExactMatchForTypes returns the function that exactly matches the given parameter types, or nil if no overload with those types exists.
type ParamTypAndValue ¶ added in v0.52.1
type ParamTypAndValue struct {
Typ *pgtypes.DoltgresType
Val any
FromCreate bool
}
ParamTypAndValue contains the parameter type and string value of argument if applicable
type QuickFunction ¶ added in v0.16.0
type QuickFunction interface {
Function
sql.RowIterExpression
// CallVariadic is the variadic form of the Call function that is specific to each implementation of QuickFunction.
// The implementation will not verify that the correct number of arguments have been passed.
CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
// ResolvedTypes returns the types that were resolved with this function.
ResolvedTypes() []*pgtypes.DoltgresType
// WithResolvedTypes returns a new QuickFunction with the replaced resolved types. The implementation will not
// verify that the new types are correct in any way. This returns a QuickFunction, however it's typed as "any" due
// to potential import cycles.
WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
}
QuickFunction represents an optimized function expression that has specific criteria in order to streamline evaluation. This will only apply to very specific functions that are generally performance-critical.
type QuickFunction1 ¶ added in v0.16.0
type QuickFunction1 struct {
Name string
Argument sql.Expression
IsStrict bool
IsSRF bool
// contains filtered or unexported fields
}
QuickFunction1 is an implementation of QuickFunction that handles a single parameter.
func (*QuickFunction1) Call ¶ added in v0.16.0
func (q *QuickFunction1) Call(ctx *sql.Context, arg0 any) (interface{}, error)
Call directly calls the underlying function with the given arguments. This does not perform any form of NULL checking as it is assumed that it was done prior to this call. It also does not validate any types. This exists purely for performance, when we can guarantee that the input is always valid and well-formed.
func (*QuickFunction1) CallVariadic ¶ added in v0.16.0
func (q *QuickFunction1) CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
CallVariadic implements the interface QuickFunction.
func (*QuickFunction1) Children ¶ added in v0.16.0
func (q *QuickFunction1) Children() []sql.Expression
Children implements the interface sql.Expression.
func (*QuickFunction1) Description ¶ added in v0.16.0
func (q *QuickFunction1) Description() string
Description implements the interface sql.Expression.
func (*QuickFunction1) EvalRowIter ¶ added in v0.51.0
EvalRowIter implements the interface sql.RowIterExpression.
func (*QuickFunction1) FunctionName ¶ added in v0.16.0
func (q *QuickFunction1) FunctionName() string
FunctionName implements the interface sql.Expression.
func (*QuickFunction1) IsNonDeterministic ¶ added in v0.16.0
func (q *QuickFunction1) IsNonDeterministic() bool
IsNonDeterministic implements the interface sql.NonDeterministicExpression.
func (*QuickFunction1) IsNullable ¶ added in v0.16.0
func (q *QuickFunction1) IsNullable(ctx *sql.Context) bool
IsNullable implements the interface sql.Expression.
func (*QuickFunction1) Resolved ¶ added in v0.16.0
func (q *QuickFunction1) Resolved() bool
Resolved implements the interface sql.Expression.
func (*QuickFunction1) ResolvedTypes ¶ added in v0.16.0
func (q *QuickFunction1) ResolvedTypes() []*pgtypes.DoltgresType
ResolvedTypes implements the interface QuickFunction.
func (*QuickFunction1) ReturnsRowIter ¶ added in v0.51.0
func (q *QuickFunction1) ReturnsRowIter() bool
ReturnsRowIter implements the interface sql.RowIterExpression.
func (*QuickFunction1) String ¶ added in v0.16.0
func (q *QuickFunction1) String() string
String implements the interface sql.Expression.
func (*QuickFunction1) Type ¶ added in v0.16.0
func (q *QuickFunction1) Type(ctx *sql.Context) sql.Type
Type implements the interface sql.Expression.
func (*QuickFunction1) WithChildren ¶ added in v0.16.0
func (q *QuickFunction1) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
WithChildren implements the interface sql.Expression.
func (*QuickFunction1) WithResolvedTypes ¶ added in v0.16.0
func (q *QuickFunction1) WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
WithResolvedTypes implements the interface QuickFunction.
type QuickFunction2 ¶ added in v0.16.0
type QuickFunction2 struct {
Name string
Arguments [2]sql.Expression
IsStrict bool
IsSRF bool
// contains filtered or unexported fields
}
QuickFunction2 is an implementation of QuickFunction that handles two parameters.
func (*QuickFunction2) Call ¶ added in v0.16.0
Call directly calls the underlying function with the given arguments. This does not perform any form of NULL checking as it is assumed that it was done prior to this call. It also does not validate any types. This exists purely for performance, when we can guarantee that the input is always valid and well-formed.
func (*QuickFunction2) CallVariadic ¶ added in v0.16.0
func (q *QuickFunction2) CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
CallVariadic implements the interface QuickFunction.
func (*QuickFunction2) Children ¶ added in v0.16.0
func (q *QuickFunction2) Children() []sql.Expression
Children implements the interface sql.Expression.
func (*QuickFunction2) Description ¶ added in v0.16.0
func (q *QuickFunction2) Description() string
Description implements the interface sql.Expression.
func (*QuickFunction2) EvalRowIter ¶ added in v0.51.0
EvalRowIter implements the interface sql.RowIterExpression.
func (*QuickFunction2) FunctionName ¶ added in v0.16.0
func (q *QuickFunction2) FunctionName() string
FunctionName implements the interface sql.Expression.
func (*QuickFunction2) IsNonDeterministic ¶ added in v0.16.0
func (q *QuickFunction2) IsNonDeterministic() bool
IsNonDeterministic implements the interface sql.NonDeterministicExpression.
func (*QuickFunction2) IsNullable ¶ added in v0.16.0
func (q *QuickFunction2) IsNullable(ctx *sql.Context) bool
IsNullable implements the interface sql.Expression.
func (*QuickFunction2) Resolved ¶ added in v0.16.0
func (q *QuickFunction2) Resolved() bool
Resolved implements the interface sql.Expression.
func (*QuickFunction2) ResolvedTypes ¶ added in v0.16.0
func (q *QuickFunction2) ResolvedTypes() []*pgtypes.DoltgresType
ResolvedTypes implements the interface QuickFunction.
func (*QuickFunction2) ReturnsRowIter ¶ added in v0.51.0
func (q *QuickFunction2) ReturnsRowIter() bool
ReturnsRowIter implements the interface sql.RowIterExpression.
func (*QuickFunction2) String ¶ added in v0.16.0
func (q *QuickFunction2) String() string
String implements the interface sql.Expression.
func (*QuickFunction2) Type ¶ added in v0.16.0
func (q *QuickFunction2) Type(ctx *sql.Context) sql.Type
Type implements the interface sql.Expression.
func (*QuickFunction2) WithChildren ¶ added in v0.16.0
func (q *QuickFunction2) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
WithChildren implements the interface sql.Expression.
func (*QuickFunction2) WithResolvedTypes ¶ added in v0.16.0
func (q *QuickFunction2) WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
WithResolvedTypes implements the interface QuickFunction.
type QuickFunction3 ¶ added in v0.16.0
type QuickFunction3 struct {
Name string
Arguments [3]sql.Expression
IsStrict bool
IsSRF bool
// contains filtered or unexported fields
}
QuickFunction3 is an implementation of QuickFunction that handles three parameters.
func (*QuickFunction3) Call ¶ added in v0.16.0
Call directly calls the underlying function with the given arguments. This does not perform any form of NULL checking as it is assumed that it was done prior to this call. It also does not validate any types. This exists purely for performance, when we can guarantee that the input is always valid and well-formed.
func (*QuickFunction3) CallVariadic ¶ added in v0.16.0
func (q *QuickFunction3) CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
CallVariadic implements the interface QuickFunction.
func (*QuickFunction3) Children ¶ added in v0.16.0
func (q *QuickFunction3) Children() []sql.Expression
Children implements the interface sql.Expression.
func (*QuickFunction3) Description ¶ added in v0.16.0
func (q *QuickFunction3) Description() string
Description implements the interface sql.Expression.
func (*QuickFunction3) EvalRowIter ¶ added in v0.51.0
EvalRowIter implements the interface sql.RowIterExpression.
func (*QuickFunction3) FunctionName ¶ added in v0.16.0
func (q *QuickFunction3) FunctionName() string
FunctionName implements the interface sql.Expression.
func (*QuickFunction3) IsNonDeterministic ¶ added in v0.16.0
func (q *QuickFunction3) IsNonDeterministic() bool
IsNonDeterministic implements the interface sql.NonDeterministicExpression.
func (*QuickFunction3) IsNullable ¶ added in v0.16.0
func (q *QuickFunction3) IsNullable(ctx *sql.Context) bool
IsNullable implements the interface sql.Expression.
func (*QuickFunction3) Resolved ¶ added in v0.16.0
func (q *QuickFunction3) Resolved() bool
Resolved implements the interface sql.Expression.
func (*QuickFunction3) ResolvedTypes ¶ added in v0.16.0
func (q *QuickFunction3) ResolvedTypes() []*pgtypes.DoltgresType
ResolvedTypes implements the interface QuickFunction.
func (*QuickFunction3) ReturnsRowIter ¶ added in v0.51.0
func (q *QuickFunction3) ReturnsRowIter() bool
ReturnsRowIter implements the interface sql.RowIterExpression.
func (*QuickFunction3) String ¶ added in v0.16.0
func (q *QuickFunction3) String() string
String implements the interface sql.Expression.
func (*QuickFunction3) Type ¶ added in v0.16.0
func (q *QuickFunction3) Type(ctx *sql.Context) sql.Type
Type implements the interface sql.Expression.
func (*QuickFunction3) WithChildren ¶ added in v0.16.0
func (q *QuickFunction3) WithChildren(ctx *sql.Context, children ...sql.Expression) (sql.Expression, error)
WithChildren implements the interface sql.Expression.
func (*QuickFunction3) WithResolvedTypes ¶ added in v0.16.0
func (q *QuickFunction3) WithResolvedTypes(newTypes []*pgtypes.DoltgresType) any
WithResolvedTypes implements the interface QuickFunction.
type SQLFunction ¶ added in v0.52.1
type SQLFunction struct {
ID id.Function
ReturnType *pgtypes.DoltgresType
AllParams []procedures.Parameter
AllTypes []*pgtypes.DoltgresType
Variadic bool
IsNonDeterministic bool
Strict bool
SqlStatement string
SetOf bool
ReturnTableType []*pgtypes.DoltgresType
}
SQLFunction is the implementation of functions created using SQL.
func (SQLFunction) GetExpectedParameterCount ¶ added in v0.52.1
func (sqlFunc SQLFunction) GetExpectedParameterCount() int
GetExpectedParameterCount implements the interface FunctionInterface.
func (SQLFunction) GetInputParameterTypes ¶ added in v0.57.3
func (sqlFunc SQLFunction) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the interface FunctionInterface.
func (SQLFunction) GetName ¶ added in v0.52.1
func (sqlFunc SQLFunction) GetName() string
GetName implements the interface FunctionInterface.
func (SQLFunction) GetOutParameters ¶ added in v0.57.3
func (sqlFunc SQLFunction) GetOutParameters() sql.Schema
GetOutParameters implements the interface FunctionInterface.
func (SQLFunction) GetReturn ¶ added in v0.52.1
func (sqlFunc SQLFunction) GetReturn() *pgtypes.DoltgresType
GetReturn implements the interface FunctionInterface.
func (SQLFunction) InternalID ¶ added in v0.52.1
func (sqlFunc SQLFunction) InternalID() id.Id
InternalID implements the interface FunctionInterface.
func (SQLFunction) IsCVariadic ¶ added in v0.56.1
func (sqlFunc SQLFunction) IsCVariadic() bool
IsCVariadic implements the FunctionInterface interface.
func (SQLFunction) IsSRF ¶ added in v0.52.1
func (sqlFunc SQLFunction) IsSRF() bool
IsSRF implements the interface FunctionInterface.
func (SQLFunction) IsStrict ¶ added in v0.52.1
func (sqlFunc SQLFunction) IsStrict() bool
IsStrict implements the interface FunctionInterface.
func (SQLFunction) NonDeterministic ¶ added in v0.52.1
func (sqlFunc SQLFunction) NonDeterministic() bool
NonDeterministic implements the interface FunctionInterface.
func (SQLFunction) VariadicIndex ¶ added in v0.52.1
func (sqlFunc SQLFunction) VariadicIndex() int
VariadicIndex implements the interface FunctionInterface.
type TypeCast ¶
type TypeCast struct {
FromType *pgtypes.DoltgresType
ToType *pgtypes.DoltgresType
Function pgtypes.TypeCastFunction
}
TypeCast is used to cast from one type to another.
type UserAggregate ¶ added in v1.2.0
type UserAggregate struct {
ID id.Function
ReturnType *pgtypes.DoltgresType
ParameterTypes []*pgtypes.DoltgresType
StateType *pgtypes.DoltgresType
SFunc id.Function
FinalFunc id.Function
InitCond string
HasInitCond bool
}
UserAggregate is the implementation of a user-defined aggregate.
func (UserAggregate) GetExpectedParameterCount ¶ added in v1.2.0
func (agg UserAggregate) GetExpectedParameterCount() int
GetExpectedParameterCount implements the interface FunctionInterface.
func (UserAggregate) GetInputParameterTypes ¶ added in v1.2.0
func (agg UserAggregate) GetInputParameterTypes() []*pgtypes.DoltgresType
GetInputParameterTypes implements the interface FunctionInterface.
func (UserAggregate) GetName ¶ added in v1.2.0
func (agg UserAggregate) GetName() string
GetName implements the interface FunctionInterface.
func (UserAggregate) GetOutParameters ¶ added in v1.2.0
func (agg UserAggregate) GetOutParameters() sql.Schema
GetOutParameters implements the interface FunctionInterface.
func (UserAggregate) GetReturn ¶ added in v1.2.0
func (agg UserAggregate) GetReturn() *pgtypes.DoltgresType
GetReturn implements the interface FunctionInterface.
func (UserAggregate) InternalID ¶ added in v1.2.0
func (agg UserAggregate) InternalID() id.Id
InternalID implements the interface FunctionInterface.
func (UserAggregate) IsCVariadic ¶ added in v1.2.0
func (agg UserAggregate) IsCVariadic() bool
IsCVariadic implements the interface FunctionInterface.
func (UserAggregate) IsSRF ¶ added in v1.2.0
func (agg UserAggregate) IsSRF() bool
IsSRF implements the interface FunctionInterface.
func (UserAggregate) IsStrict ¶ added in v1.2.0
func (agg UserAggregate) IsStrict() bool
IsStrict implements the interface FunctionInterface.
func (UserAggregate) NewBuffer ¶ added in v1.2.0
func (agg UserAggregate) NewBuffer(exprs []sql.Expression) (sql.AggregationBuffer, error)
NewBuffer implements the interface AggregateFunctionInterface.
func (UserAggregate) NewWindowFunc ¶ added in v1.2.0
func (agg UserAggregate) NewWindowFunc() NewWindowFunctionFn
NewWindowFunc implements the interface AggregateFunctionInterface.
func (UserAggregate) NonDeterministic ¶ added in v1.2.0
func (agg UserAggregate) NonDeterministic() bool
NonDeterministic implements the interface FunctionInterface.
func (UserAggregate) VariadicIndex ¶ added in v1.2.0
func (agg UserAggregate) VariadicIndex() int
VariadicIndex implements the interface FunctionInterface.
type UserFunctionCall ¶ added in v1.2.0
type UserFunctionCall struct {
// contains filtered or unexported fields
}
UserFunctionCall is a resolved call to a user-defined function that takes argument values rather than argument expressions.
func NewUserFunctionCall ¶ added in v1.2.0
func NewUserFunctionCall(ctx *sql.Context, schemaName string, functionName string, paramTypes []*pgtypes.DoltgresType) *UserFunctionCall
NewUserFunctionCall resolves the named function for the given parameter types. Returns nil if no overload matches.
type WindowFramerState ¶ added in v1.0.0
type WindowFramerState struct {
// contains filtered or unexported fields
}
WindowFramerState holds the sql.WindowFramer setup shared by every native window-function implementation that respects an explicit frame clause rather than always operating over the whole partition - e.g. the native sum/avg aggregates and nth_value(). Bind a framer from the window's explicit frame clause if one was given; with no explicit frame, DefaultFramer supplies Postgres's default frame: RANGE UNBOUNDED PRECEDING TO CURRENT ROW when the window has an ORDER BY (so rows tied on the ORDER BY value share a peer group), otherwise the whole partition.
func (*WindowFramerState) BindFramer ¶ added in v1.0.0
func (s *WindowFramerState) BindFramer(window *sql.WindowDefinition) error
BindFramer builds and stores this window's framer, if it declared an explicit frame clause; with no explicit frame, DefaultFramer's fallback applies instead.
func (*WindowFramerState) DefaultFramer ¶ added in v1.0.0
func (s *WindowFramerState) DefaultFramer() sql.WindowFramer
DefaultFramer implements the sql.WindowFunction interface; with no explicit frame, this supplies Postgres's default frame: RANGE UNBOUNDED PRECEDING TO CURRENT ROW when the window has an ORDER BY (so rows tied on the ORDER BY value share a peer group), otherwise the whole partition.
func (*WindowFramerState) Dispose ¶ added in v1.0.0
func (s *WindowFramerState) Dispose(ctx *sql.Context)
Dispose implements the sql.WindowFunction interface.
func (*WindowFramerState) StartPartition ¶ added in v1.0.0
func (s *WindowFramerState) StartPartition(ctx *sql.Context, interval sql.WindowInterval, buf sql.WindowBuffer) error
StartPartition implements the sql.WindowFunction interface.
type WindowFunctionInterface ¶ added in v0.57.1
type WindowFunctionInterface interface {
FunctionInterface
// NewWindowFunc returns the constructor used to build this function's runtime sql.WindowFunction.
NewWindowFunc() NewWindowFunctionFn
}
WindowFunctionInterface is an interface for PostgreSQL functions that may only be used as window functions (i.e. within an OVER(...) clause) and have no GROUP BY equivalent, such as row_number() or rank().
type WindowOnlyFunction ¶ added in v0.57.1
type WindowOnlyFunction interface {
sql.FunctionExpression
sql.WindowAggregation
// contains filtered or unexported methods
}
WindowOnlyFunction is an expression that represents CompiledWindowFunction: a PostgreSQL function that may only be used as a window function (within an OVER(...) clause), such as row_number() or rank().
Source Files
¶
- cast.go
- catalog.go
- common_type.go
- compiled_aggregate_function.go
- compiled_catalog.go
- compiled_function.go
- compiled_window_function.go
- extension_function.go
- functions.go
- gms_conversion.go
- intermediate_function.go
- interpreted_function.go
- operators.go
- overloads.go
- provider.go
- quick_function.go
- sql_function.go
- user_aggregate.go
- user_function_call.go
- window_framer_state.go