createClient function

Client createClient({
  1. String? dsn,
  2. String? instanceName,
  3. String? credentials,
  4. String? credentialsFile,
  5. String? host,
  6. int? port,
  7. String? database,
  8. String? user,
  9. String? password,
  10. String? secretKey,
  11. Map<String, String>? serverSettings,
  12. String? tlsCA,
  13. String? tlsCAFile,
  14. TLSSecurity? tlsSecurity,
  15. Duration? waitUntilAvailable,
  16. ConnectConfig? config,
  17. int? concurrency,
})

Creates a new Client instance with the provided connection options.

Usually it's recommended to not pass any connection options here, and instead let the client resolve the connection options from the edgedb project or environment variables. See the Client Library Connection documentation for details on connection options and how they are resolved.

The config parameter allows you to pass in a ConnectConfig object, which is just a wrapper object containing connection options to make them easier to manage in your application. If a connection option exists both in the config object and is passed as a parameter, the value passed as a parameter will override the value in the config object.

Alongside the connection options, there are the following parameters:

  • concurrency: Specifies the maximum number of connections the Client will create in it's connection pool. If not specified the concurrency will be controlled by the server. This is recommended as it allows the server to better manage the number of client connections based on it's own available resources.

Implementation

Client createClient(
    {String? dsn,
    String? instanceName,
    String? credentials,
    String? credentialsFile,
    String? host,
    int? port,
    String? database,
    String? user,
    String? password,
    String? secretKey,
    Map<String, String>? serverSettings,
    String? tlsCA,
    String? tlsCAFile,
    TLSSecurity? tlsSecurity,
    Duration? waitUntilAvailable,
    ConnectConfig? config,
    int? concurrency}) {
  return Client._create(
      ClientPool(
          TCPProtocol.create,
          ConnectConfig(
              dsn: dsn ?? config?.dsn,
              instanceName: instanceName ?? config?.instanceName,
              credentials: credentials ?? config?.credentials,
              credentialsFile: credentialsFile ?? config?.credentialsFile,
              host: host ?? config?.host,
              port: port ?? config?.port,
              database: database ?? config?.database,
              user: user ?? config?.user,
              password: password ?? config?.password,
              secretKey: secretKey ?? config?.secretKey,
              serverSettings: serverSettings ?? config?.serverSettings,
              tlsCA: tlsCA ?? config?.tlsCA,
              tlsCAFile: tlsCAFile ?? config?.tlsCAFile,
              tlsSecurity: tlsSecurity ?? config?.tlsSecurity,
              waitUntilAvailable:
                  waitUntilAvailable ?? config?.waitUntilAvailable),
          concurrency: concurrency),
      Options.defaults());
}