Skip to content

Commit

Permalink
Add gel as a valid dsn scheme. (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark authored Nov 29, 2024
2 parents c5bff17 + 5ac6b68 commit 571a4e5
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 106 deletions.
4 changes: 2 additions & 2 deletions lib/src/connect_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -794,9 +794,9 @@ Future<void> parseDSNIntoConfig(
throw InterfaceError("invalid DSN or instance name: '${dsnString.value}'");
}

if (!parsed.isScheme('edgedb')) {
if (!parsed.isScheme('edgedb') && !parsed.isScheme('gel')) {
throw InterfaceError(
"invalid DSN: schema is expected to be 'edgedb', got '${parsed.scheme}'");
"invalid DSN: schema is expected to be 'gel', got '${parsed.scheme}'");
}

final searchParams = <String, String>{};
Expand Down
106 changes: 53 additions & 53 deletions rstdocs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ API

.. code-block:: dart
Client createClient(
{String? dsn,
Client createClient({
String? dsn,
String? instanceName,
String? credentials,
String? credentialsFile,
Expand All @@ -30,7 +30,7 @@ API
TLSSecurity? tlsSecurity,
Duration? waitUntilAvailable,
ConnectConfig? config,
int? concurrency}
int? concurrency, }
)
Creates a new :ref:`Client <edgedb-dart-Client>` instance with the provided connection options.
Expand Down Expand Up @@ -139,9 +139,9 @@ mis-configuration).

.. code-block:: dart
Future<void> execute(
String query,
[dynamic args]
Future<void> execute(
String query, [
dynamic args]
)
Executes a query, returning no result.
Expand All @@ -157,9 +157,9 @@ For details on ``args`` see the ``edgedb`` library

.. code-block:: dart
Future<List> query(
String query,
[dynamic args]
Future<List> query(
String query, [
dynamic args]
)
Executes a query, returning a ``List`` of results.
Expand All @@ -175,9 +175,9 @@ For details on result types and ``args`` see the ``edgedb`` library

.. code-block:: dart
Future<String> queryJSON(
String query,
[dynamic args]
Future<String> queryJSON(
String query, [
dynamic args]
)
Executes a query, returning the result as a JSON encoded ``String``.
Expand All @@ -193,9 +193,9 @@ For details on ``args`` see the ``edgedb`` library

.. code-block:: dart
Future queryRequiredSingle(
String query,
[dynamic args]
Future queryRequiredSingle(
String query, [
dynamic args]
)
Executes a query, returning a single (non-``null``) result.
Expand All @@ -215,9 +215,9 @@ For details on result types and ``args`` see the ``edgedb`` library

.. code-block:: dart
Future<String> queryRequiredSingleJSON(
String query,
[dynamic args]
Future<String> queryRequiredSingleJSON(
String query, [
dynamic args]
)
Executes a query, returning the result as a JSON encoded ``String``.
Expand All @@ -237,9 +237,9 @@ For details on ``args`` see the ``edgedb`` library

.. code-block:: dart
Future querySingle(
String query,
[dynamic args]
Future querySingle(
String query, [
dynamic args]
)
Executes a query, returning a single (possibly ``null``) result.
Expand All @@ -258,9 +258,9 @@ For details on result types and ``args`` see the ``edgedb`` library

.. code-block:: dart
Future<String> querySingleJSON(
String query,
[dynamic args]
Future<String> querySingleJSON(
String query, [
dynamic args]
)
Executes a query, returning the result as a JSON encoded ``String``.
Expand Down Expand Up @@ -292,8 +292,8 @@ for any running queries to finish.

.. code-block:: dart
Future<T> transaction<T>(
Future<T> action(Transaction)
Future<T> transaction<T>(
Future<T> action( Transaction)
)
Execute a retryable transaction.
Expand Down Expand Up @@ -338,7 +338,7 @@ with :ref:`withRetryOptions() <edgedb-dart-Client-withRetryOptions>`.

.. code-block:: dart
Client withConfig(
Client withConfig(
Map<String, Object> config
)
Expand All @@ -360,7 +360,7 @@ configuration parameters refer to the

.. code-block:: dart
Client withGlobals(
Client withGlobals(
Map<String, dynamic> globals
)
Expand Down Expand Up @@ -389,7 +389,7 @@ Example:

.. code-block:: dart
Client withModuleAliases(
Client withModuleAliases(
Map<String, String> aliases
)
Expand Down Expand Up @@ -421,7 +421,7 @@ Example:

.. code-block:: dart
Client withRetryOptions(
Client withRetryOptions(
RetryOptions options
)
Expand All @@ -435,7 +435,7 @@ Returns a new :ref:`Client <edgedb-dart-Client>` instance with the specified :re

.. code-block:: dart
Client withSession(
Client withSession(
Session session
)
Expand All @@ -453,7 +453,7 @@ methods for convenience.

.. code-block:: dart
Client withTransactionOptions(
Client withTransactionOptions(
TransactionOptions options
)
Expand All @@ -475,10 +475,10 @@ Manages all options (:ref:`RetryOptions <edgedb-dart-RetryOptions>`, :ref:`Trans

.. code-block:: dart
Options(
{RetryOptions? retryOptions,
Options({
RetryOptions? retryOptions,
TransactionOptions? transactionOptions,
Session? session}
Session? session, }
)
Expand Down Expand Up @@ -535,7 +535,7 @@ Creates a new :ref:`Options <edgedb-dart-Options>` object with all options set t

.. code-block:: dart
Options withRetryOptions(
Options withRetryOptions(
RetryOptions options
)
Expand All @@ -549,7 +549,7 @@ Returns a new :ref:`Options <edgedb-dart-Options>` object with the specified :re

.. code-block:: dart
Options withSession(
Options withSession(
Session session
)
Expand All @@ -563,7 +563,7 @@ Returns a new :ref:`Options <edgedb-dart-Options>` object with the specified :re

.. code-block:: dart
Options withTransactionOptions(
Options withTransactionOptions(
TransactionOptions options
)
Expand All @@ -585,11 +585,11 @@ to be used when executing a query.

.. code-block:: dart
Session(
{String module = 'default',
Session({
String module = 'default',
Map<String, String>? moduleAliases,
Map<String, Object>? config,
Map<String, dynamic>? globals}
Map<String, dynamic>? globals, }
)
Creates a new :ref:`Session <edgedb-dart-Session>` object with the given options.
Expand Down Expand Up @@ -660,7 +660,7 @@ Creates a new :ref:`Session <edgedb-dart-Session>` with all options set to their

.. code-block:: dart
Session withConfig(
Session withConfig(
Map<String, Object> config
)
Expand All @@ -682,7 +682,7 @@ configuration parameters refer to the

.. code-block:: dart
Session withGlobals(
Session withGlobals(
Map<String, dynamic> globals
)
Expand All @@ -701,7 +701,7 @@ Equivalent to using the ``set global`` command.

.. code-block:: dart
Session withModuleAliases(
Session withModuleAliases(
Map<String, String> aliases
)
Expand Down Expand Up @@ -736,9 +736,9 @@ which override the default for given error conditions.

.. code-block:: dart
RetryOptions(
{int? attempts,
BackoffFunction? backoff}
RetryOptions({
int? attempts,
BackoffFunction? backoff, }
)
Creates a new :ref:`RetryOptions <edgedb-dart-RetryOptions>` object, with a default `RetryRule <https://pub.dev/documentation/edgedb/latest/edgedb/RetryRule-class.html>`__, with
Expand Down Expand Up @@ -778,10 +778,10 @@ Creates a new :ref:`RetryOptions <edgedb-dart-RetryOptions>` with all options se

.. code-block:: dart
RetryOptions withRule(
{required RetryCondition condition,
RetryOptions withRule({
required RetryCondition condition,
int? attempts,
BackoffFunction? backoff}
BackoffFunction? backoff, }
)
Adds a new `RetryRule <https://pub.dev/documentation/edgedb/latest/edgedb/RetryRule-class.html>`__ with the given ``attempts`` and ``backoff`` function,
Expand Down Expand Up @@ -809,10 +809,10 @@ For more details on transaction modes see the

.. code-block:: dart
TransactionOptions(
{IsolationLevel? isolation,
TransactionOptions({
IsolationLevel? isolation,
bool? readonly,
bool? deferrable}
bool? deferrable, }
)
Creates a new :ref:`TransactionOptions <edgedb-dart-TransactionOptions>` object with the given ``isolation``,
Expand Down
32 changes: 16 additions & 16 deletions rstdocs/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,43 @@ in parentheses are also valid for query parameters):
* - EdgeDB type
- Dart type
* - Sets
- `List\<dynamic\> <https://api.dart.dev/stable/3.4.4/dart-core/List-class.html>`__
- `List\<dynamic\> <https://api.dart.dev/stable/3.5.4/dart-core/List-class.html>`__
* - Arrays
- `List\<dynamic\> <https://api.dart.dev/stable/3.4.4/dart-core/List-class.html>`__
- `List\<dynamic\> <https://api.dart.dev/stable/3.5.4/dart-core/List-class.html>`__
* - Objects
- `Map\<String, dynamic\> <https://api.dart.dev/stable/3.4.4/dart-core/Map-class.html>`__
- `Map\<String, dynamic\> <https://api.dart.dev/stable/3.5.4/dart-core/Map-class.html>`__
* - Tuples (``tuple<x, y, ...>``)
- `List\<dynamic\> <https://api.dart.dev/stable/3.4.4/dart-core/List-class.html>`__
- `List\<dynamic\> <https://api.dart.dev/stable/3.5.4/dart-core/List-class.html>`__
* - Named tuples (``tuple<foo: x, bar: y, ...>``)
- `Map\<String, dynamic\> <https://api.dart.dev/stable/3.4.4/dart-core/Map-class.html>`__
- `Map\<String, dynamic\> <https://api.dart.dev/stable/3.5.4/dart-core/Map-class.html>`__
* - Ranges
- :ref:`Range\<dynamic\> <edgedb-dart-Range>`
* - Multiranges
- :ref:`MultiRange\<dynamic\> <edgedb-dart-MultiRange>`
* - Enums
- `String <https://api.dart.dev/stable/3.4.4/dart-core/String-class.html>`__
- `String <https://api.dart.dev/stable/3.5.4/dart-core/String-class.html>`__
* - ``str``
- `String <https://api.dart.dev/stable/3.4.4/dart-core/String-class.html>`__
- `String <https://api.dart.dev/stable/3.5.4/dart-core/String-class.html>`__
* - ``bool``
- `bool <https://api.dart.dev/stable/3.4.4/dart-core/bool-class.html>`__
- `bool <https://api.dart.dev/stable/3.5.4/dart-core/bool-class.html>`__
* - ``int16``/``int32``/``int64``
- `int <https://api.dart.dev/stable/3.4.4/dart-core/int-class.html>`__
- `int <https://api.dart.dev/stable/3.5.4/dart-core/int-class.html>`__
* - ``float32``/``float64``
- `double <https://api.dart.dev/stable/3.4.4/dart-core/double-class.html>`__
- `double <https://api.dart.dev/stable/3.5.4/dart-core/double-class.html>`__
* - ``json``
- as decoded by ``json.decode()``
* - ``uuid``
- `String <https://api.dart.dev/stable/3.4.4/dart-core/String-class.html>`__
- `String <https://api.dart.dev/stable/3.5.4/dart-core/String-class.html>`__
* - ``bigint``
- `BigInt <https://api.dart.dev/stable/3.4.4/dart-core/BigInt-class.html>`__
- `BigInt <https://api.dart.dev/stable/3.5.4/dart-core/BigInt-class.html>`__
* - ``decimal``
- *(unsupported)*
* - ``bytes``
- `Uint8List <https://api.dart.dev/stable/3.4.4/dart-typed_data/Uint8List-class.html>`__
- `Uint8List <https://api.dart.dev/stable/3.5.4/dart-typed_data/Uint8List-class.html>`__
* - ``datetime``
- `DateTime <https://api.dart.dev/stable/3.4.4/dart-core/DateTime-class.html>`__
- `DateTime <https://api.dart.dev/stable/3.5.4/dart-core/DateTime-class.html>`__
* - ``duration``
- `Duration <https://api.dart.dev/stable/3.4.4/dart-core/Duration-class.html>`__
- `Duration <https://api.dart.dev/stable/3.5.4/dart-core/Duration-class.html>`__
* - ``cal::local_datetime``
- `LocalDateTime <https://pub.dev/documentation/edgedb/latest/edgedb/LocalDateTime-class.html>`__
* - ``cal::local_date``
Expand All @@ -124,7 +124,7 @@ in parentheses are also valid for query parameters):
* - ``cfg::memory``
- :ref:`ConfigMemory <edgedb-dart-ConfigMemory>`
* - ``ext::pgvector::vector``
- `Float32List <https://api.dart.dev/stable/3.4.4/dart-typed_data/Float32List-class.html>`__ (`List\<double\> <https://api.dart.dev/stable/3.4.4/dart-core/List-class.html>`__)
- `Float32List <https://api.dart.dev/stable/3.5.4/dart-typed_data/Float32List-class.html>`__ (`List\<double\> <https://api.dart.dev/stable/3.5.4/dart-core/List-class.html>`__)

Custom types
------------
Expand Down
Loading

0 comments on commit 571a4e5

Please sign in to comment.