queryb

Types

pub type CaseSensitivity {
  CaseSensitive
  CaseInsensitive
}

Constructors

  • CaseSensitive
  • CaseInsensitive
pub type Condition {
  Equal(left: QueryValue, right: QueryValue)
  StringContains(
    string: QueryValue,
    substring: QueryValue,
    sensitivity: CaseSensitivity,
  )
  Or(List(Condition))
}

Constructors

  • Equal(left: QueryValue, right: QueryValue)
  • StringContains(
      string: QueryValue,
      substring: QueryValue,
      sensitivity: CaseSensitivity,
    )
  • Or(List(Condition))
pub type Direction {
  Ascending
  Descending
}

Constructors

  • Ascending
  • Descending
pub type Query {
  Select(
    from: String,
    columns: List(#(Option(String), String)),
    order_by: #(String, Direction),
    limit: Int,
    offset: Int,
    where: List(Condition),
  )
  Update(
    table: String,
    set: List(#(String, QueryValue)),
    where: List(Condition),
  )
  Delete(from: String, where: List(Condition))
}

Constructors

  • Select(
      from: String,
      columns: List(#(Option(String), String)),
      order_by: #(String, Direction),
      limit: Int,
      offset: Int,
      where: List(Condition),
    )
  • Update(
      table: String,
      set: List(#(String, QueryValue)),
      where: List(Condition),
    )
  • Delete(from: String, where: List(Condition))
pub type QueryError {
  ConstraintViolation(name: String, detail: String)
  DatabaseError(detail: String)
}

Constructors

  • ConstraintViolation(name: String, detail: String)
  • DatabaseError(detail: String)
pub type QueryValue {
  RelationValue(table: Option(String), column: String)
  Parameter(number: Int)
}

Constructors

  • RelationValue(table: Option(String), column: String)
  • Parameter(number: Int)
pub type Value {
  TextValue(String)
  IntValue(Int)
  FloatValue(Float)
  NullValue
}

Constructors

  • TextValue(String)
  • IntValue(Int)
  • FloatValue(Float)
  • NullValue

Functions

pub fn to_postgresql(query: Query) -> String
pub fn to_sql(
  query: Query,
  query_parameter_prefix param: String,
  escaped_double_quote quote: String,
) -> String
Search Document