Gel.Client.State (Gel v0.9.0)

View Source

State for the client is an execution context that affects the execution of EdgeQL commands in different ways:

  1. default module.
  2. module aliases.
  3. session config.
  4. global values.

The most convenient way to work with the state is to use the Gel API to change a required part of the state.

See Gel.with_client_state/2, Gel.with_default_module/2, Gel.with_module_aliases/2/Gel.without_module_aliases/2, Gel.with_config/2/Gel.without_config/2 and Gel.with_globals/2/Gel.without_globals/2 for more information.

Summary

Types

Config to be passed to Gel.with_config/2.

Keys that Gel accepts for changing client behaviour configuration.

t()

State for the client is an execution context that affects the execution of EdgeQL commands.

Functions

Returns an Gel.Client.State with adjusted session config.

Returns an Gel.Client.State with adjusted default module.

Returns an Gel.Client.State with adjusted global values.

Returns an Gel.Client.State with adjusted module aliases.

Returns an Gel.Client.State without specified session config.

Returns an Gel.Client.State without specified globals.

Returns an Gel.Client.State without specified module aliases.

Types

config()

(since 0.7.0)
@type config() :: %{required(config_key()) => term()} | [{config_key(), term()}]

Config to be passed to Gel.with_config/2.

config_key()

(since 0.7.0)
@type config_key() ::
  :allow_user_specified_id
  | :session_idle_timeout
  | :session_idle_transaction_timeout
  | :query_execution_timeout

Keys that Gel accepts for changing client behaviour configuration.

The meaning and acceptable values can be found in the docs.

t()

@opaque t()

State for the client is an execution context that affects the execution of EdgeQL commands.

Functions

with_config(state, config \\ %{})

@spec with_config(t(), config()) :: t()

Returns an Gel.Client.State with adjusted session config.

This is equivalent to using the configure session set command.

with_default_module(state, module \\ nil)

@spec with_default_module(t(), String.t() | nil) :: t()

Returns an Gel.Client.State with adjusted default module.

This is equivalent to using the set module command, or using the reset module command when giving nil.

with_globals(state, globals \\ %{})

@spec with_globals(t(), %{required(String.t()) => String.t()}) :: t()

Returns an Gel.Client.State with adjusted global values.

This is equivalent to using the set global command.

with_module_aliases(state, aliases \\ %{})

@spec with_module_aliases(t(), %{required(String.t()) => String.t()}) :: t()

Returns an Gel.Client.State with adjusted module aliases.

This is equivalent to using the set alias command.

without_config(state, config_keys \\ [])

@spec without_config(t(), [config_key()]) :: t()

Returns an Gel.Client.State without specified session config.

This is equivalent to using the configure session reset command.

without_globals(state, global_names \\ [])

@spec without_globals(t(), [String.t()]) :: t()

Returns an Gel.Client.State without specified globals.

This is equivalent to using the reset global command.

without_module_aliases(state, aliases \\ [])

@spec without_module_aliases(t(), [String.t()]) :: t()

Returns an Gel.Client.State without specified module aliases.

This is equivalent to using the reset alias command.