withGlobals method

Client withGlobals(
  1. Map<String, dynamic> globals
)

Returns a new Client instance with the specified global values.

The globals parameter is merged with any existing globals defined on the current client instance.

Equivalent to using the set global command.

Example:

final user = await client.withGlobals({
  'userId': '...'
}).querySingle('''
  select User {name} filter .id = global userId
''');

Implementation

Client withGlobals(Map<String, dynamic> globals) {
  return Client._create(
      _pool, _options.withSession(_options.session.withGlobals(globals)));
}