Structure
SQLBinaryExpression
A fundamental syntactical expression - a left and right operand joined by an infix operator.
struct SQLBinaryExpression
Overview
This construct forms the basis of most comparisons, conditionals, and compounds which can be represented by an expression.
For example, the expression foo = 1 AND bar <> 'baz' OR bop - 5 NOT IN (1, 3) can be represented in terms of nested SQLBinaryExpressions (note that there is more than one “correct” way to nest this particular example):
let expr = SQLBinaryExpression(
SQLBinaryExpression(SQLColumn("foo"), .equal, SQLLiteral.numeric("1")),
.and,
SQLBinaryExpression(
SQLBinaryExpression(SQLColumn("bar"), .notEqual, SQLLiteral.string("baz")),
.or,
SQLBinaryExpression(
SQLBinaryExpression(SQLColumn("bop"), .subtract, SQLLiteral.numeric("5")),
.notIn,
SQLGroupExpression(SQLLiteral.numeric("1"), SQLLiteral.numeric("3"))
)
)
)
Topics
Initializers
init(_:_:_:)Create anSQLBinaryExpressionfrom two operand expressions and a predefined binary operator.init(left:op:right:)Create anSQLBinaryExpressionfrom component expressions.
Instance Properties
leftThe left-side operand of the expression.opThe operator joining the left and right operands.rightThe right-side operand of the expression.
Instance Methods
serialize(to:)Invoked when a request is made to serialize the expression to raw SQL.
Relationships
Conforms To
SQLExpressionSwift.SendableSwift.SendableMetatype
See Also
Syntactic Expressions
SQLBinaryOperatorSQL binary expression operators.SQLBindA parameterizied value bound to the SQL query.SQLFunctionA call to a function available in SQL, expressed as a name and a (possibly empty) list of arguments.SQLGroupExpressionA fundamental syntactical expression - an arbitrary expression or list of expressions, surroudned by parenthesis.SQLIdentifierA fundamental syntactical expression - a quoted identifier (also often referred to as a “name” or “object name”).SQLListA fundamental syntactical expression - a list of subexpresions with a specified “separator” subexpression.SQLLiteralA fundamental syntactical expression - one of several various kinds of literal SQL expressions.SQLRawA fundamental syntactical expression - an arbitrary string of raw SQL with no escaping or formating of any kind.