suweal/node

Types

pub type AllNS {
  AllNS(create: fn() -> Node)
}

Constructors

  • AllNS(create: fn() -> Node)
pub type ArrayNS {
  ArrayNS(create: fn() -> Node, add: fn(Node, Node) -> Node)
}

Constructors

pub type BinopNS {
  BinopNS(
    create: fn(Node, Operator, Node) -> Node,
    equal: fn(Node, Node) -> Node,
    not_equal: fn(Node, Node) -> Node,
    greater_than: fn(Node, Node) -> Node,
    less_than: fn(Node, Node) -> Node,
    greater_than_or_equal: fn(Node, Node) -> Node,
    less_than_or_equal: fn(Node, Node) -> Node,
    access: fn(Node, Node) -> Node,
    namespace_access: fn(Node, Node) -> Node,
    inside: fn(Node, Node) -> Node,
    relation_to: fn(Node, Node) -> Node,
    relation_from: fn(Node, Node) -> Node,
    relation_to_from: fn(Node, Node) -> Node,
    indexing: fn(Node, Node) -> Node,
    and: fn(Node, Node) -> Node,
    or: fn(Node, Node) -> Node,
  )
}

Constructors

pub type CreateNS {
  CreateNS(
    create: fn(String) -> Node,
    set_only: fn(Node, Bool) -> Node,
    add_set: fn(Node, Node) -> Node,
  )
}

Constructors

pub type DefineAccessNS {
  DefineAccessNS(
    create: fn(String) -> Node,
    with_strategy: fn(Node, DefineAccessStrategy) -> Node,
    with_target: fn(Node, DefineAccessTarget) -> Node,
    with_signin: fn(Node, Node) -> Node,
    with_signup: fn(Node, Node) -> Node,
    with_jwt_config: fn(Node, JWTConfiguration) -> Node,
  )
}

Constructors

pub type DefineAccessStrategy {
  DefineAccessIfNotExists
  DefineAccessOverwrite
  DefineAccessRegular
}

Constructors

  • DefineAccessIfNotExists
  • DefineAccessOverwrite
  • DefineAccessRegular
pub type DefineAccessTarget {
  DefineAccessDatabase
  DefineAccessNamespace
  DefineAccessRoot
}

Constructors

  • DefineAccessDatabase
  • DefineAccessNamespace
  • DefineAccessRoot
pub type DefineAccessType {
  DefineAccessRecord(
    signup: option.Option(Node),
    signin: option.Option(Node),
    jwt_config: option.Option(JWTConfiguration),
  )
}

Constructors

pub type DefineFieldNS {
  DefineFieldNS(
    create: fn(Node, String, surreal_type.SurrealType) -> Node,
    with_strategy: fn(Node, DefineFieldStrategy) -> Node,
    with_default: fn(Node, Node) -> Node,
    with_assert: fn(Node, Node) -> Node,
    add_permission: fn(Node, Permission) -> Node,
    set_flexible: fn(Node, Bool) -> Node,
  )
}

Constructors

pub type DefineFieldStrategy {
  DefineFieldIfNotExists
  DefineFieldOverwrite
  DefineFieldRegular
}

Constructors

  • DefineFieldIfNotExists
  • DefineFieldOverwrite
  • DefineFieldRegular
pub type DefineIndexNS {
  DefineIndexNS(
    create: fn(String, String) -> Node,
    add_field: fn(Node, String) -> Node,
    set_unique: fn(Node, Bool) -> Node,
  )
}

Constructors

  • DefineIndexNS(
      create: fn(String, String) -> Node,
      add_field: fn(Node, String) -> Node,
      set_unique: fn(Node, Bool) -> Node,
    )
pub type DefineTableNS {
  DefineTableNS(
    create: fn(String) -> Node,
    with_strategy: fn(Node, DefineTableStrategy) -> Node,
    with_schema: fn(Node, SchemaType) -> Node,
    with_type: fn(Node, TableType) -> Node,
    add_permission: fn(Node, Permission) -> Node,
    set_as: fn(Node, Node) -> Node,
  )
}

Constructors

pub type DefineTableStrategy {
  DefineTableIfNotExists
  DefineTableOverwrite
  DefineTableRegular
}

Constructors

  • DefineTableIfNotExists
  • DefineTableOverwrite
  • DefineTableRegular
pub type DeleteNS {
  DeleteNS(
    create: fn(Node) -> Node,
    set_only: fn(Node, Bool) -> Node,
    with_where: fn(Node, Node) -> Node,
  )
}

Constructors

pub type FunctionCallNS {
  FunctionCallNS(
    create: fn(Node) -> Node,
    add: fn(Node, Node) -> Node,
  )
}

Constructors

pub type IdentifierNS {
  IdentifierNS(create: fn(String) -> Node)
}

Constructors

  • IdentifierNS(create: fn(String) -> Node)
pub type IfNS {
  IfNS(
    create: fn(Node, Node, Node) -> Node,
    add_else_if: fn(Node, Node, Node) -> Node,
  )
}

Constructors

pub type JWTConfiguration {
  JWTConfiguration(algorithm: Node, key: Node)
}

Constructors

  • JWTConfiguration(algorithm: Node, key: Node)
pub type LambdaNS {
  LambdaNS(
    create: fn(Node) -> Node,
    add_parameter: fn(Node, String) -> Node,
  )
}

Constructors

  • LambdaNS(
      create: fn(Node) -> Node,
      add_parameter: fn(Node, String) -> Node,
    )
pub type Node {
  DefineTable(
    name: String,
    strategy: DefineTableStrategy,
    schema: SchemaType,
    type_: TableType,
    permissions: List(Permission),
    as_: option.Option(Node),
  )
  DefineField(
    name: Node,
    strategy: DefineFieldStrategy,
    table: String,
    type_: surreal_type.SurrealType,
    flexible: Bool,
    default: option.Option(Node),
    assert_: option.Option(Node),
    permissions: List(Permission),
  )
  DefineIndex(
    name: String,
    table: String,
    fields: List(String),
    unique: Bool,
  )
  DefineAccess(
    name: String,
    strategy: DefineAccessStrategy,
    target: DefineAccessTarget,
    type_: DefineAccessType,
  )
  FunctionCall(node: Node, arguments: List(Node))
  Self
  None
  All
  Number(Float)
  Parameter(String)
  Identifier(String)
  Value(surreal_ql.SurrealQL)
  Object(List(#(String, Node)))
  Array(List(Node))
  Select(
    fields: List(SelectField),
    only: Bool,
    table: String,
    where: option.Option(Node),
    order: option.Option(List(#(Node, OrderDirection))),
    limit: option.Option(Node),
    group_all: Bool,
  )
  If(
    condition: Node,
    then_: Node,
    else_ifs: List(#(Node, Node)),
    else_: Node,
  )
  BinaryOperator(lhs: Node, operator: Operator, rhs: Node)
  WrappedNode(node: Node)
  Update(
    only: Bool,
    target: String,
    set: List(Node),
    where: option.Option(Node),
  )
  Create(only: Bool, target: String, set: List(Node))
  Relate(table: String, from: Node, to: Node, set: List(Node))
  Lambda(parameters: List(String), body: Node)
  Delete(only: Bool, target: Node, where: option.Option(Node))
}

Constructors

  • DefineTable(
      name: String,
      strategy: DefineTableStrategy,
      schema: SchemaType,
      type_: TableType,
      permissions: List(Permission),
      as_: option.Option(Node),
    )

    https://surrealdb.com/docs/reference/query-language/statements/define/table

  • DefineField(
      name: Node,
      strategy: DefineFieldStrategy,
      table: String,
      type_: surreal_type.SurrealType,
      flexible: Bool,
      default: option.Option(Node),
      assert_: option.Option(Node),
      permissions: List(Permission),
    )

    https://surrealdb.com/docs/reference/query-language/statements/define/field

  • DefineIndex(
      name: String,
      table: String,
      fields: List(String),
      unique: Bool,
    )

    https://surrealdb.com/docs/reference/query-language/statements/define/indexes

  • DefineAccess(
      name: String,
      strategy: DefineAccessStrategy,
      target: DefineAccessTarget,
      type_: DefineAccessType,
    )

    https://surrealdb.com/docs/reference/query-language/statements/define/access

  • FunctionCall(node: Node, arguments: List(Node))
  • Self

    https://surrealdb.com/docs/learn/data-models/graph/recursive-traversals

  • None

    https://surrealdb.com/docs/reference/query-language/language-primitives/data-types/none-and-null

  • All

    https://surrealdb.com/docs/learn/data-models/graph/graph-traversal

  • Number(Float)

    https://surrealdb.com/docs/reference/query-language/language-primitives/data-types/numbers Different from Value(surreal_ql.Float | surreal_ql.Int) as it can be coerced to both types.

  • Parameter(String)

    https://surrealdb.com/docs/reference/query-language/language-primitives/parameters

  • Identifier(String)

    Raw Identifier

  • https://surrealdb.com/docs/reference/query-language/language-primitives/data-types/values

  • Object(List(#(String, Node)))

    https://surrealdb.com/docs/reference/query-language/language-primitives/data-types/objects

  • Array(List(Node))

    https://surrealdb.com/docs/reference/query-language/language-primitives/data-types/arrays

  • Select(
      fields: List(SelectField),
      only: Bool,
      table: String,
      where: option.Option(Node),
      order: option.Option(List(#(Node, OrderDirection))),
      limit: option.Option(Node),
      group_all: Bool,
    )

    https://surrealdb.com/docs/reference/query-language/statements/select

  • If(
      condition: Node,
      then_: Node,
      else_ifs: List(#(Node, Node)),
      else_: Node,
    )

    https://surrealdb.com/docs/reference/query-language/statements/if-else

  • BinaryOperator(lhs: Node, operator: Operator, rhs: Node)

    https://surrealdb.com/docs/reference/query-language/language-primitives/operators

  • WrappedNode(node: Node)

    Node wrapped in ()

  • Update(
      only: Bool,
      target: String,
      set: List(Node),
      where: option.Option(Node),
    )

    https://surrealdb.com/docs/reference/query-language/statements/update

  • Create(only: Bool, target: String, set: List(Node))

    https://surrealdb.com/docs/reference/query-language/statements/create

  • Relate(table: String, from: Node, to: Node, set: List(Node))

    https://surrealdb.com/docs/reference/query-language/statements/relate

  • Lambda(parameters: List(String), body: Node)

    https://surrealdb.com/docs/reference/query-language/language-primitives/data-types/closures

  • Delete(only: Bool, target: Node, where: option.Option(Node))

    https://surrealdb.com/docs/reference/query-language/statements/delete

pub type NoneNS {
  NoneNS(create: fn() -> Node)
}

Constructors

  • NoneNS(create: fn() -> Node)
pub type NumberNS {
  NumberNS(create: fn(Float) -> Node)
}

Constructors

  • NumberNS(create: fn(Float) -> Node)
pub type ObjectNS {
  ObjectNS(
    create: fn() -> Node,
    add: fn(Node, String, Node) -> Node,
  )
}

Constructors

pub type OperationType {
  OperationCreate
  OperationSelect
  OperationUpdate
  OperationDelete
}

Constructors

  • OperationCreate
  • OperationSelect
  • OperationUpdate
  • OperationDelete
pub type Operator {
  Equal
  NotEqual
  GreaterThan
  LessThan
  GreaterThanOrEqual
  LessThanOrEqual
  Access
  NamespaceAccess
  Inside
  RelationTo
  RelationFrom
  RelationToFrom
  Indexing
  And
  Or
}

Constructors

  • Equal
  • NotEqual
  • GreaterThan
  • LessThan
  • GreaterThanOrEqual
  • LessThanOrEqual
  • Access
  • NamespaceAccess
  • Inside
  • RelationTo
  • RelationFrom
  • RelationToFrom
  • Indexing
  • And
  • Or
pub type OrderDirection {
  Ascending
  Descending
}

Constructors

  • Ascending
  • Descending
pub type ParameterNS {
  ParameterNS(create: fn(String) -> Node)
}

Constructors

  • ParameterNS(create: fn(String) -> Node)
pub type Permission {
  PermissionFull
  PermissionNone
  PermissionForFull(targets: List(OperationType))
  PermissionForNone(targets: List(OperationType))
  PermissionForWhere(
    targets: List(OperationType),
    expression: Node,
  )
}

Constructors

pub type RelateNS {
  RelateNS(
    create: fn(String, Node, Node) -> Node,
    add_set: fn(Node, Node) -> Node,
  )
}

Constructors

The type of schema of a table in SurrealDB.

pub type SchemaType {
  Schemafull
  Schemaless
}

Constructors

  • Schemafull
  • Schemaless

Represents a field in a SELECT statement in SurrealQL.

pub type SelectField {
  SelectField(
    field: Node,
    alias: option.Option(String),
    value: Bool,
  )
}

Constructors

pub type SelectNS {
  SelectNS(
    create: fn(String) -> Node,
    add_field: fn(Node, Node) -> Node,
    add_value_field: fn(Node, Node) -> Node,
    add_field_as: fn(Node, Node, String) -> Node,
    add_value_field_as: fn(Node, Node, String) -> Node,
    with_where: fn(Node, Node) -> Node,
    add_order: fn(Node, Node, OrderDirection) -> Node,
    with_limit: fn(Node, Node) -> Node,
    set_group_all: fn(Node, Bool) -> Node,
    set_only: fn(Node, Bool) -> Node,
  )
}

Constructors

pub type SelfNS {
  SelfNS(create: fn() -> Node)
}

Constructors

  • SelfNS(create: fn() -> Node)
pub type TableType {
  NormalTable
  RelationTable(in: String, out: String)
}

Constructors

  • NormalTable
  • RelationTable(in: String, out: String)
pub type UpdateNS {
  UpdateNS(
    create: fn(String) -> Node,
    set_only: fn(Node, Bool) -> Node,
    add_set: fn(Node, Node) -> Node,
    with_where: fn(Node, Node) -> Node,
  )
}

Constructors

pub type ValueNS {
  ValueNS(
    create: fn(surreal_ql.SurrealQL) -> Node,
    string: fn(String) -> Node,
    int: fn(Int) -> Node,
    float: fn(Float) -> Node,
    bool: fn(Bool) -> Node,
  )
}

Constructors

pub type WrappedNS {
  WrappedNS(create: fn(Node) -> Node)
}

Constructors

Values

pub const all: AllNS
pub fn all_create() -> Node
pub const array: ArrayNS
pub fn array_add(array: Node, value: Node) -> Node
pub fn array_create() -> Node
pub const binop: BinopNS
pub fn binop_access(lhs: Node, rhs: Node) -> Node
pub fn binop_and(lhs: Node, rhs: Node) -> Node
pub fn binop_create(
  lhs: Node,
  operator: Operator,
  rhs: Node,
) -> Node
pub fn binop_equal(lhs: Node, rhs: Node) -> Node
pub fn binop_greater_than(lhs: Node, rhs: Node) -> Node
pub fn binop_greater_than_or_equal(lhs: Node, rhs: Node) -> Node
pub fn binop_index(lhs: Node, rhs: Node) -> Node
pub fn binop_inside(lhs: Node, rhs: Node) -> Node
pub fn binop_less_than(lhs: Node, rhs: Node) -> Node
pub fn binop_less_than_or_equal(lhs: Node, rhs: Node) -> Node
pub fn binop_namespace_access(lhs: Node, rhs: Node) -> Node
pub fn binop_not_equal(lhs: Node, rhs: Node) -> Node
pub fn binop_or(lhs: Node, rhs: Node) -> Node
pub fn binop_relation_from(lhs: Node, rhs: Node) -> Node
pub fn binop_relation_to(lhs: Node, rhs: Node) -> Node
pub fn binop_relation_to_from(lhs: Node, rhs: Node) -> Node
pub const create: CreateNS
pub fn create_add_set(node: Node, item: Node) -> Node
pub fn create_create(target: String) -> Node
pub fn create_set_only(node: Node, only: Bool) -> Node
pub const define_access: DefineAccessNS
pub fn define_access_create(name: String) -> Node
pub fn define_access_strategy_to_module(
  strategy: DefineAccessStrategy,
) -> module.Module
pub fn define_access_strategy_to_string(
  strategy: DefineAccessStrategy,
) -> String
pub fn define_access_target_to_module(
  target: DefineAccessTarget,
) -> module.Module
pub fn define_access_target_to_string(
  target: DefineAccessTarget,
) -> String
pub fn define_access_type_to_module(
  type_: DefineAccessType,
) -> module.Module
pub fn define_access_with_jwt_config(
  node: Node,
  config: JWTConfiguration,
) -> Node
pub fn define_access_with_signin(
  node: Node,
  signin: Node,
) -> Node
pub fn define_access_with_signup(
  node: Node,
  signup: Node,
) -> Node
pub fn define_access_with_strategy(
  node: Node,
  strategy: DefineAccessStrategy,
) -> Node
pub fn define_access_with_target(
  node: Node,
  target: DefineAccessTarget,
) -> Node
pub const define_field: DefineFieldNS
pub fn define_field_add_permission(
  node: Node,
  permission: Permission,
) -> Node
pub fn define_field_create(
  name: Node,
  table: String,
  type_: surreal_type.SurrealType,
) -> Node
pub fn define_field_set_flexible(
  node: Node,
  flexible: Bool,
) -> Node
pub fn define_field_strategy_to_module(
  strategy: DefineFieldStrategy,
) -> module.Module
pub fn define_field_strategy_to_string(
  strategy: DefineFieldStrategy,
) -> String
pub fn define_field_with_assert(
  node: Node,
  assert_: Node,
) -> Node
pub fn define_field_with_default(
  node: Node,
  default: Node,
) -> Node
pub fn define_field_with_strategy(
  node: Node,
  strategy: DefineFieldStrategy,
) -> Node
pub const define_index: DefineIndexNS
pub fn define_index_add_field(node: Node, field: String) -> Node
pub fn define_index_create(name: String, table: String) -> Node
pub fn define_index_set_unique(node: Node, unique: Bool) -> Node
pub const define_table: DefineTableNS
pub fn define_table_add_permission(
  node: Node,
  permission: Permission,
) -> Node
pub fn define_table_create(name: String) -> Node
pub fn define_table_set_as(node: Node, as_: Node) -> Node
pub fn define_table_strategy_to_module(
  strategy: DefineTableStrategy,
) -> module.Module
pub fn define_table_strategy_to_string(
  strategy: DefineTableStrategy,
) -> String
pub fn define_table_with_schema(
  node: Node,
  schema: SchemaType,
) -> Node
pub fn define_table_with_strategy(
  node: Node,
  strategy: DefineTableStrategy,
) -> Node
pub fn define_table_with_type(
  node: Node,
  type_: TableType,
) -> Node
pub const delete: DeleteNS
pub fn delete_create(target: Node) -> Node
pub fn delete_set_only(node: Node, only: Bool) -> Node
pub fn delete_with_where(node: Node, where: Node) -> Node
pub const function_call: FunctionCallNS
pub fn function_call_add_argument(call: Node, arg: Node) -> Node
pub fn function_call_create(lhs: Node) -> Node
pub const identifier: IdentifierNS
pub fn identifier_create(name: String) -> Node
pub const if_: IfNS
pub fn if_add_else_if(
  if_node: Node,
  condition: Node,
  then: Node,
) -> Node
pub fn if_create(
  condition: Node,
  then: Node,
  else_: Node,
) -> Node
pub fn jwt_configuration_to_module(
  config: JWTConfiguration,
) -> module.Module
pub const lambda: LambdaNS
pub fn lambda_add_parameter(
  node: Node,
  parameter: String,
) -> Node
pub fn lambda_create(body: Node) -> Node
pub const none: NoneNS
pub fn none_create() -> Node
pub const number: NumberNS
pub fn number_create(value: Float) -> Node
pub const object: ObjectNS
pub fn object_add(object: Node, key: String, value: Node) -> Node
pub fn object_create() -> Node
pub fn operation_type_to_module(
  operation_type: OperationType,
) -> module.Module
pub fn operation_type_to_string(
  operation_type: OperationType,
) -> String
pub fn operator_to_module(operator: Operator) -> module.Module

Converts an [Operator] into a module for code generation.

pub fn operator_to_string(operator: Operator) -> String

Converts an [Operator] into its [String] representation in SurrealQL.

pub fn order_direction_to_module(
  direction: OrderDirection,
) -> module.Module

Converts an [OrderDirection] into a module for code generation.

pub fn order_direction_to_string(
  direction: OrderDirection,
) -> String

Converts an [OrderDirection] into its [String] representation in SurrealQL.

pub const parameter: ParameterNS
pub fn parameter_create(name: String) -> Node
pub fn permission_to_module(
  permission: Permission,
) -> module.Module
pub fn permission_to_string(permission: Permission) -> String
pub const relate: RelateNS
pub fn relate_add_set(node: Node, item: Node) -> Node
pub fn relate_create(table: String, from: Node, to: Node) -> Node
pub fn replace_variables(
  node: Node,
  values: List(#(String, surreal_ql.SurrealQL)),
) -> Node
pub fn schema_type_to_module(
  schema_type: SchemaType,
) -> module.Module

Converts a [SchemaType] into a module for code generation.

pub fn schema_type_to_string(schema_type: SchemaType) -> String

Converts a [SchemaType] into its [String] representation in SurrealQL.

pub const select: SelectNS
pub fn select_add_field(select: Node, field: Node) -> Node
pub fn select_add_field_as(
  select: Node,
  field: Node,
  alias: String,
) -> Node
pub fn select_add_order(
  select: Node,
  node: Node,
  order: OrderDirection,
) -> Node
pub fn select_add_value_field(select: Node, field: Node) -> Node
pub fn select_add_value_field_as(
  select: Node,
  field: Node,
  alias: String,
) -> Node
pub fn select_create(table: String) -> Node
pub fn select_field_to_module(
  field: SelectField,
) -> module.Module
pub fn select_field_to_string(field: SelectField) -> String
pub fn select_set_group_all(
  select: Node,
  group_all: Bool,
) -> Node
pub fn select_set_only(select: Node, only: Bool) -> Node
pub fn select_with_limit(select: Node, limit: Node) -> Node
pub fn select_with_where(select: Node, condition: Node) -> Node
pub const self: SelfNS
pub fn self_create() -> Node
pub fn table_type_to_module(
  table_type: TableType,
) -> module.Module
pub fn table_type_to_string(table_type: TableType) -> String
pub fn to_module(node: Node) -> module.Module
pub fn to_string(node: Node) -> String
pub const update: UpdateNS
pub fn update_add_set(node: Node, item: Node) -> Node
pub fn update_create(target: String) -> Node
pub fn update_set_only(node: Node, only: Bool) -> Node
pub fn update_with_where(node: Node, where: Node) -> Node
pub const value: ValueNS
pub fn value_create(value: surreal_ql.SurrealQL) -> Node
pub fn value_create_bool(value: Bool) -> Node
pub fn value_create_float(value: Float) -> Node
pub fn value_create_int(value: Int) -> Node
pub fn value_create_string(value: String) -> Node
pub const wrapped: WrappedNS
pub fn wrapped_create(node: Node) -> Node
✨ Search Document