TypeDB.Options (TypeDB v0.2.0)

Copy Markdown View Source

Transaction and query options, and their translation to the HTTP wire format.

You do not normally call anything here. Pass these as ordinary keyword options to TypeDB.query/4, TypeDB.Transaction.open/4 or TypeDB.Transaction.query/3, mixed in with everything else:

TypeDB.query(conn, "social", query, transaction_type: :read, answer_count_limit: 100)

TypeDB.Options.Query and TypeDB.Options.Transaction are the canonical list of which key belongs to which set — the driver splits your keyword list by exactly that. query_payload/2 and transaction_payload/2 accept either form and are here for tooling that builds requests itself.

Transaction options

  • :transaction_timeout_millis — how long the server keeps an idle transaction alive before killing it. This is a server-side setting and is passed straight through; how long the driver itself waits for a response is :timeout, on the connection or on the individual call.
  • :schema_lock_acquire_timeout_millis — how long a schema transaction waits for the exclusive schema lock.

Query options

  • :include_instance_types — attach the type to every returned instance. Costs an extra type lookup per concept; turn it off for hot read paths where you already know the shape.
  • :answer_count_limit — cap the number of answers TypeDB materialises. The HTTP API is not streaming, so this is your protection against a match that matches the whole database. Exceeding it produces a warning on the answer rather than an error.
  • :include_query_structure — return the analysed pipeline structure alongside the rows, and populate involved_blocks on each row.

Options are accepted as plain keyword lists everywhere in the public API; building these structs by hand is optional.

Summary

Functions

Extracts query options, returning the wire payload or nil when none were given.

Extracts transaction options, returning the wire payload or nil when none were given.

Functions

query_payload(options, defaults \\ [])

@spec query_payload(
  keyword() | TypeDB.Options.Query.t() | nil,
  keyword()
) :: map() | nil

Extracts query options, returning the wire payload or nil when none were given.

defaults fills in options the caller did not set — used for the connection-level :answer_count_limit.

transaction_payload(options, defaults \\ [])

@spec transaction_payload(
  keyword() | TypeDB.Options.Transaction.t() | nil,
  keyword()
) :: map() | nil

Extracts transaction options, returning the wire payload or nil when none were given.

defaults fills in options the caller did not set.