suweal/surreal_ql

Types

The values for Surreal Query Language (SurrealQL)

pub type SurrealQL {
  String(String)
  Int(Int)
  Float(Float)
  Bool(Bool)
  Datetime(String)
  Null
  Object(List(#(String, SurrealQL)))
  Raw(String)
  Array(List(SurrealQL))
}

Constructors

  • String(String)
  • Int(Int)
  • Float(Float)
  • Bool(Bool)
  • Datetime(String)
  • Null
  • Object(List(#(String, SurrealQL)))
  • Raw(String)

    Be careful when using this especially if its value directly comes from the user input, as it will be included in the query as-is. This can lead to potential security risks like SQL injection if not handled properly.

  • Array(List(SurrealQL))

Values

pub fn array(
  value: List(a),
  to_surql: fn(a) -> SurrealQL,
) -> SurrealQL

Transforms the list of values into [SurrealQL] values using the given converter.

pub fn from_json_value(value: json_value.JsonValue) -> SurrealQL

Converts a given [JsonValue] into a [SurrealQL] value.

pub fn nullable(
  value: option.Option(a),
  to_surql: fn(a) -> SurrealQL,
) -> SurrealQL

Transforms the given option into a SurrealQL value, if the provided [value] is [None], it will be transformed into [Null] and otherwise converted to the relevant type using [to_surql]

pub fn to_json(value: SurrealQL) -> json.Json

Converts the given SurrealQL [value] into a Json value

pub fn to_string(value: SurrealQL) -> String

Converts the given SurrealQL [value] into a String.

✨ Search Document