galchemy/ast/expression

Types

pub type BinaryOperator {
  Add
  Subtract
  Multiply
  Divide
  Concat
}

Constructors

  • Add
  • Subtract
  • Multiply
  • Divide
  • Concat
pub type ComparisonOp {
  Eq
  Neq
  Gt
  Gte
  Lt
  Lte
}

Constructors

  • Eq
  • Neq
  • Gt
  • Gte
  • Lt
  • Lte
pub type Cte {
  Cte(name: String, query: SelectQuery)
}

Constructors

pub type Expression {
  ColumnExpr(schema.ColumnMeta)
  ValueExpr(SqlValue)
  StarExpr
  FunctionExpr(name: String, arguments: List(Expression))
  UnaryOpExpr(operator: UnaryOperator, operand: Expression)
  BinaryOpExpr(
    lhs: Expression,
    operator: BinaryOperator,
    rhs: Expression,
  )
  WindowExpr(function: Expression, window: WindowDefinition)
  SubqueryExpr(SelectQuery)
}

Constructors

pub type Join {
  Join(kind: JoinKind, source: Source, on: Predicate)
}

Constructors

pub type JoinKind {
  InnerJoin
  LeftJoin
}

Constructors

  • InnerJoin
  • LeftJoin
pub type Order {
  Order(expression: Expression, direction: OrderDirection)
}

Constructors

pub type OrderDirection {
  Asc
  Desc
}

Constructors

  • Asc
  • Desc
pub type Predicate {
  Comparison(lhs: Expression, op: ComparisonOp, rhs: Expression)
  And(left: Predicate, right: Predicate)
  Or(left: Predicate, right: Predicate)
  Not(predicate: Predicate)
  InList(lhs: Expression, rhs: List(Expression))
  InSubquery(lhs: Expression, rhs: SelectQuery)
  IsNull(expression: Expression)
  IsNotNull(expression: Expression)
  Like(lhs: Expression, rhs: Expression)
  Ilike(lhs: Expression, rhs: Expression)
}

Constructors

pub type SelectItem {
  SelectItem(
    expression: Expression,
    alias: option.Option(String),
  )
}

Constructors

pub type SelectQuery {
  SelectQuery(
    ctes: List(Cte),
    items: List(SelectItem),
    from: option.Option(Source),
    joins: List(Join),
    where_: option.Option(Predicate),
    group_by: List(Expression),
    having_: option.Option(Predicate),
    unions: List(SetOperation),
    order_by: List(Order),
    limit: option.Option(Int),
    offset: option.Option(Int),
    distinct: Bool,
  )
}

Constructors

pub type SetOperation {
  SetOperation(kind: SetOperationKind, query: SelectQuery)
}

Constructors

pub type SetOperationKind {
  Union
  UnionAll
}

Constructors

  • Union
  • UnionAll
pub type Source {
  TableSource(schema.Table)
  DerivedSource(query: SelectQuery, alias: String)
}

Constructors

pub type SqlValue {
  Text(String)
  Int(Int)
  Float(Float)
  Bool(Bool)
  Bytea(BitArray)
  Uuid(String)
  Numeric(String)
  Json(String)
  Jsonb(String)
  Enum(type_name: String, value: String)
  Array(List(SqlValue))
  Timestamp(timestamp.Timestamp)
  Date(calendar.Date)
  TimeOfDay(calendar.TimeOfDay)
  Null
}

Constructors

pub type UnaryOperator {
  Negate
}

Constructors

  • Negate
pub type WindowDefinition {
  WindowDefinition(
    partition_by: List(Expression),
    order_by: List(Order),
  )
}

Constructors

  • WindowDefinition(
      partition_by: List(Expression),
      order_by: List(Order),
    )
Search Document