AssociativeBinaryOperator

public struct AssociativeBinaryOperator : Hashable

AssociativeBinaryOperator is an associative binary operator, such as +, *, AND, etc.

Use it with the joined(operator:) method. For example:

// SELECT score + bonus + 1000 FROM player
let values = [
    scoreColumn,
    bonusColumn,
    1000.databaseValue]
Player.select(values.joined(operator: .add))
  • add

    The + binary operator

    For example:

    // score + bonus
    [Column("score"), Column("bonus")].joined(operator: .add)
    

    Declaration

    Swift

    public static let add: SQLExpression.AssociativeBinaryOperator
  • The * binary operator

    For example:

    // score * factor
    [Column("score"), Column("factor")].joined(operator: .multiply)
    

    Declaration

    Swift

    public static let multiply: SQLExpression.AssociativeBinaryOperator
  • and

    The AND binary operator

    For example:

    // isBlue AND isTall
    [Column("isBlue"), Column("isTall")].joined(operator: .and)
    

    Declaration

    Swift

    public static let and: SQLExpression.AssociativeBinaryOperator
  • or

    The OR binary operator

    For example:

    // isBlue OR isTall
    [Column("isBlue"), Column("isTall")].joined(operator: .or)
    

    Declaration

    Swift

    public static let or: SQLExpression.AssociativeBinaryOperator
  • The || string concatenation operator

    For example:

    // firstName || ' ' || lastName
    [Column("firstName"), " ", Column("lastName")].joined(operator: .concat)
    

    Declaration

    Swift

    public static let concat: SQLExpression.AssociativeBinaryOperator