diff --git a/lib/src/connect_config.dart b/lib/src/connect_config.dart index bb302de..4b92c70 100644 --- a/lib/src/connect_config.dart +++ b/lib/src/connect_config.dart @@ -794,9 +794,9 @@ Future 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 = {}; diff --git a/rstdocs/api.rst b/rstdocs/api.rst index fbc1e36..f01e80d 100644 --- a/rstdocs/api.rst +++ b/rstdocs/api.rst @@ -12,8 +12,8 @@ API .. code-block:: dart - Client createClient( - {String? dsn, + Client createClient({ + String? dsn, String? instanceName, String? credentials, String? credentialsFile, @@ -30,7 +30,7 @@ API TLSSecurity? tlsSecurity, Duration? waitUntilAvailable, ConnectConfig? config, - int? concurrency} + int? concurrency, } ) Creates a new :ref:`Client ` instance with the provided connection options. @@ -139,9 +139,9 @@ mis-configuration). .. code-block:: dart - Future execute( - String query, - [dynamic args] + Future execute( + String query, [ + dynamic args] ) Executes a query, returning no result. @@ -157,9 +157,9 @@ For details on ``args`` see the ``edgedb`` library .. code-block:: dart - Future query( - String query, - [dynamic args] + Future query( + String query, [ + dynamic args] ) Executes a query, returning a ``List`` of results. @@ -175,9 +175,9 @@ For details on result types and ``args`` see the ``edgedb`` library .. code-block:: dart - Future queryJSON( - String query, - [dynamic args] + Future queryJSON( + String query, [ + dynamic args] ) Executes a query, returning the result as a JSON encoded ``String``. @@ -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. @@ -215,9 +215,9 @@ For details on result types and ``args`` see the ``edgedb`` library .. code-block:: dart - Future queryRequiredSingleJSON( - String query, - [dynamic args] + Future queryRequiredSingleJSON( + String query, [ + dynamic args] ) Executes a query, returning the result as a JSON encoded ``String``. @@ -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. @@ -258,9 +258,9 @@ For details on result types and ``args`` see the ``edgedb`` library .. code-block:: dart - Future querySingleJSON( - String query, - [dynamic args] + Future querySingleJSON( + String query, [ + dynamic args] ) Executes a query, returning the result as a JSON encoded ``String``. @@ -292,8 +292,8 @@ for any running queries to finish. .. code-block:: dart - Future transaction( - Future action(Transaction) + Future transaction( + Future action( Transaction) ) Execute a retryable transaction. @@ -338,7 +338,7 @@ with :ref:`withRetryOptions() `. .. code-block:: dart - Client withConfig( + Client withConfig( Map config ) @@ -360,7 +360,7 @@ configuration parameters refer to the .. code-block:: dart - Client withGlobals( + Client withGlobals( Map globals ) @@ -389,7 +389,7 @@ Example: .. code-block:: dart - Client withModuleAliases( + Client withModuleAliases( Map aliases ) @@ -421,7 +421,7 @@ Example: .. code-block:: dart - Client withRetryOptions( + Client withRetryOptions( RetryOptions options ) @@ -435,7 +435,7 @@ Returns a new :ref:`Client ` instance with the specified :re .. code-block:: dart - Client withSession( + Client withSession( Session session ) @@ -453,7 +453,7 @@ methods for convenience. .. code-block:: dart - Client withTransactionOptions( + Client withTransactionOptions( TransactionOptions options ) @@ -475,10 +475,10 @@ Manages all options (:ref:`RetryOptions `, :ref:`Trans .. code-block:: dart - Options( - {RetryOptions? retryOptions, + Options({ + RetryOptions? retryOptions, TransactionOptions? transactionOptions, - Session? session} + Session? session, } ) @@ -535,7 +535,7 @@ Creates a new :ref:`Options ` object with all options set t .. code-block:: dart - Options withRetryOptions( + Options withRetryOptions( RetryOptions options ) @@ -549,7 +549,7 @@ Returns a new :ref:`Options ` object with the specified :re .. code-block:: dart - Options withSession( + Options withSession( Session session ) @@ -563,7 +563,7 @@ Returns a new :ref:`Options ` object with the specified :re .. code-block:: dart - Options withTransactionOptions( + Options withTransactionOptions( TransactionOptions options ) @@ -585,11 +585,11 @@ to be used when executing a query. .. code-block:: dart - Session( - {String module = 'default', + Session({ + String module = 'default', Map? moduleAliases, Map? config, - Map? globals} + Map? globals, } ) Creates a new :ref:`Session ` object with the given options. @@ -660,7 +660,7 @@ Creates a new :ref:`Session ` with all options set to their .. code-block:: dart - Session withConfig( + Session withConfig( Map config ) @@ -682,7 +682,7 @@ configuration parameters refer to the .. code-block:: dart - Session withGlobals( + Session withGlobals( Map globals ) @@ -701,7 +701,7 @@ Equivalent to using the ``set global`` command. .. code-block:: dart - Session withModuleAliases( + Session withModuleAliases( Map aliases ) @@ -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 ` object, with a default `RetryRule `__, with @@ -778,10 +778,10 @@ Creates a new :ref:`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 `__ with the given ``attempts`` and ``backoff`` function, @@ -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 ` object with the given ``isolation``, diff --git a/rstdocs/client.rst b/rstdocs/client.rst index 45ed935..9e84164 100644 --- a/rstdocs/client.rst +++ b/rstdocs/client.rst @@ -74,43 +74,43 @@ in parentheses are also valid for query parameters): * - EdgeDB type - Dart type * - Sets - - `List\ `__ + - `List\ `__ * - Arrays - - `List\ `__ + - `List\ `__ * - Objects - - `Map\ `__ + - `Map\ `__ * - Tuples (``tuple``) - - `List\ `__ + - `List\ `__ * - Named tuples (``tuple``) - - `Map\ `__ + - `Map\ `__ * - Ranges - :ref:`Range\ ` * - Multiranges - :ref:`MultiRange\ ` * - Enums - - `String `__ + - `String `__ * - ``str`` - - `String `__ + - `String `__ * - ``bool`` - - `bool `__ + - `bool `__ * - ``int16``/``int32``/``int64`` - - `int `__ + - `int `__ * - ``float32``/``float64`` - - `double `__ + - `double `__ * - ``json`` - as decoded by ``json.decode()`` * - ``uuid`` - - `String `__ + - `String `__ * - ``bigint`` - - `BigInt `__ + - `BigInt `__ * - ``decimal`` - *(unsupported)* * - ``bytes`` - - `Uint8List `__ + - `Uint8List `__ * - ``datetime`` - - `DateTime `__ + - `DateTime `__ * - ``duration`` - - `Duration `__ + - `Duration `__ * - ``cal::local_datetime`` - `LocalDateTime `__ * - ``cal::local_date`` @@ -124,7 +124,7 @@ in parentheses are also valid for query parameters): * - ``cfg::memory`` - :ref:`ConfigMemory ` * - ``ext::pgvector::vector`` - - `Float32List `__ (`List\ `__) + - `Float32List `__ (`List\ `__) Custom types ------------ diff --git a/rstdocs/datatypes.rst b/rstdocs/datatypes.rst index c297a7a..60e21ce 100644 --- a/rstdocs/datatypes.rst +++ b/rstdocs/datatypes.rst @@ -38,11 +38,11 @@ as the result of some operation on a range. .. code-block:: dart - Range( + Range( T? lower, - T? upper, - {bool? incLower, - bool? incUpper} + T? upper, { + bool? incLower, + bool? incUpper, } ) Creates a new :ref:`Range `. @@ -144,13 +144,13 @@ The upper boundary of the range, if it exists. .. code-block:: dart - int compareTo( + int compareTo( Range other ) Compares this object to another object. -Returns a value like a `Comparator `__ when comparing ``this`` to ``other``. +Returns a value like a `Comparator `__ when comparing ``this`` to ``other``. That is, it returns a negative integer if ``this`` is ordered before ``other``, a positive integer if ``this`` is ordered after ``other``, and zero if ``this`` and ``other`` are ordered together. @@ -165,7 +165,7 @@ The ``other`` argument must be a value that is comparable to this object. .. code-block:: dart - bool contains( + bool contains( T element ) @@ -179,7 +179,7 @@ Checks whether ``element`` is within this range. .. code-block:: dart - bool containsRange( + bool containsRange( Range range ) @@ -193,7 +193,7 @@ Checks whether ``range`` is entirely within this range. .. code-block:: dart - bool overlaps( + bool overlaps( Range other ) @@ -233,8 +233,8 @@ boundaries by ``()``. If the range is empty, returns the string ``'empty'``. .. code-block:: dart - Iterable unpack( - {Object? step} + Iterable unpack({ + Object? step, } ) If the range is discrete and no ``step`` is provided, returns an ``Iterable`` @@ -254,7 +254,7 @@ non-discrete ranges. .. code-block:: dart - Range operator *( + Range operator *( Range other ) @@ -268,7 +268,7 @@ Returns the intersection of two ranges. .. code-block:: dart - Range operator +( + Range operator +( Range other ) @@ -284,7 +284,7 @@ Throws an error if the result is not a single continuous range. .. code-block:: dart - Range operator -( + Range operator -( Range other ) @@ -300,7 +300,7 @@ Throws an error if the result is not a single continuous range. .. code-block:: dart - bool operator <( + bool operator <( Range other ) @@ -320,7 +320,7 @@ lower/greater than specified lower/upper bounds respectively. .. code-block:: dart - bool operator <=( + bool operator <=( Range other ) @@ -340,7 +340,7 @@ lower/greater than specified lower/upper bounds respectively. .. code-block:: dart - bool operator ==( + bool operator ==( Object other ) @@ -354,7 +354,7 @@ Returns whether two ranges are equal. .. code-block:: dart - bool operator >( + bool operator >( Range other ) @@ -374,7 +374,7 @@ lower/greater than specified lower/upper bounds respectively. .. code-block:: dart - bool operator >=( + bool operator >=( Range other ) @@ -399,7 +399,7 @@ lower/greater than specified lower/upper bounds respectively. .. code-block:: dart - MultiRange( + MultiRange( Iterable> ranges ) @@ -441,7 +441,7 @@ but must be consistent between changes to the set. int get length -The number of elements in :ref:`this `. +The number of elements in this `Iterable `__. Counting all elements may involve iterating through all elements and can therefore be slow. @@ -456,7 +456,7 @@ These *must* override the default implementation of ``length``. .. code-block:: dart - bool add( + bool add( Range value ) @@ -495,7 +495,7 @@ Example: .. code-block:: dart - bool contains( + bool contains( Object? element ) @@ -515,7 +515,7 @@ Whether ``value`` is in the set. .. code-block:: dart - Range? lookup( + Range? lookup( Object? element ) @@ -548,7 +548,7 @@ set element. .. code-block:: dart - bool remove( + bool remove( Object? value ) @@ -585,7 +585,7 @@ The method has no effect if ``value`` was not in the set. Set> toSet() -Creates a `Set `__ with the same elements and behavior as this ``Set``. +Creates a `Set `__ with the same elements and behavior as this ``Set``. The returned set behaves the same as this set with regard to adding and removing elements. @@ -606,7 +606,7 @@ the returned set will have the same order. A string representation of this object. Some classes have a default textual representation, -often paired with a static ``parse`` function (like `int.parse `__). +often paired with a static ``parse`` function (like `int.parse `__). These classes will provide the textual representation as their string representation. @@ -624,7 +624,7 @@ mainly for debugging or logging. .. code-block:: dart - bool operator ==( + bool operator ==( Object other ) @@ -648,7 +648,7 @@ ambiguous 'kB', which can mean 1000 or 1024 bytes. .. code-block:: dart - ConfigMemory( + ConfigMemory( int _bytes ) @@ -661,7 +661,7 @@ ambiguous 'kB', which can mean 1000 or 1024 bytes. .. code-block:: dart - ConfigMemory.parse( + ConfigMemory.parse( String mem ) @@ -745,7 +745,7 @@ ambiguous 'kB', which can mean 1000 or 1024 bytes. A string representation of this object. Some classes have a default textual representation, -often paired with a static ``parse`` function (like `int.parse `__). +often paired with a static ``parse`` function (like `int.parse `__). These classes will provide the textual representation as their string representation. diff --git a/rstdocs/index.rst b/rstdocs/index.rst index d9a9adb..5d8fa96 100644 --- a/rstdocs/index.rst +++ b/rstdocs/index.rst @@ -1,4 +1,5 @@ -.. _edgedb-dart-intro: +.. edb:tag:: dart + .. _edgedb-dart-intro: Dart client library for EdgeDB ============================== diff --git a/test/client_test.dart b/test/client_test.dart index d4ab0c5..ba12e8b 100644 --- a/test/client_test.dart +++ b/test/client_test.dart @@ -610,7 +610,7 @@ void main() { select (dt, datetime_get(dt, 'epochseconds') * 1000) '''); expect( - (res[0] as DateTime).millisecondsSinceEpoch, (res[1] as num).ceil()); + (res[0] as DateTime).millisecondsSinceEpoch, (res[1] as num).floor()); } finally { await client.close(); } diff --git a/test/range_test.dart b/test/range_test.dart index 796ca15..60b8182 100644 --- a/test/range_test.dart +++ b/test/range_test.dart @@ -1531,7 +1531,7 @@ void main() { u.subtract(Duration(days: 1)), u, u.add(Duration(days: 1)), - DateTime(275760, 09, 13) + DateTime(275760, 09, 12) ]; expect(ranges.map((range) => elements.map((el) => range.contains(el))), [ @@ -1638,7 +1638,7 @@ void main() { final l = DateTime(2022, 08, 30); final u = DateTime(2022, 09, 02); final min = DateTime(-271821, 04, 21); - final max = DateTime(275760, 09, 13); + final max = DateTime(275760, 09, 12); final ranges = >[ Range(l, u, incLower: true, incUpper: false),