Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ libraryDependencies ++= Seq(

## Usage

The `EdgeDBClient` class contains all the methods necessary to interact with the EdgeDB database.
The `GelClientPool` class contains all the methods necessary to interact with the EdgeDB database.

```java
import com.edgedb.driver.EdgeDBClient;
import com.edgedb.driver.GelClientPool;

void main() {
var client = new EdgeDBClient();
var clientPool = new GelClientPool();

client.query(String.class, "SELECT 'Hello, Java!'")
clientPool.query(String.class, "SELECT 'Hello, Java!'")
.thenAccept(System.out::println);
}
```

The `EdgeDBClient` uses `CompletionStage` for asynchronous operations, allowing you
The `GelClientPool` uses `CompletionStage` for asynchronous operations, allowing you
to integrate it with your favorite asynchronous frameworks

```java
import com.edgedb.driver.EdgeDBClient;
import com.edgedb.driver.GelClientPool;
import reactor.core.publisher.Mono;

void main() {
var client = new EdgeDBClient();
var clientPool = new GelClientPool();

Mono.fromFuture(client.querySingle(String.class, "SELECT 'Hello, Java!'"))
Mono.fromFuture(clientPool.querySingle(String.class, "SELECT 'Hello, Java!'"))
.doOnNext(System.out::println)
.block();
}
Expand All @@ -75,15 +75,15 @@ This also means it plays nicely with other JVM language that support asynchronou

```kotlin

import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.GelClientPool
import kotlinx.coroutines.future.await
import kotlinx.coroutines.runBlocking

fun main() {
val client = EdgeDBClient()
val clientPool = GelClientPool()

runBlocking {
client.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'")
clientPool.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'")
.thenAccept { println(it) }
.await()
}
Expand All @@ -92,20 +92,20 @@ fun main() {

```scala

import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.GelClientPool
import scala.jdk.FutureConverters.*

object Main extends App {
val client = new EdgeDBClient()
val clientPool = new GelClientPool()

client.querySingle(classOf[String], "SELECT 'Hello, Scala!'")
clientPool.querySingle(classOf[String], "SELECT 'Hello, Scala!'")
.asScala
.map(println)
}
```

## Examples
Some examples of using the Java client api can be found in the [examples](./examples) directory.
Some examples of using the Java clientPool api can be found in the [examples](./examples) directory.

## Compiling
This project uses gradle. To build the project run the following command:
Expand Down
14 changes: 7 additions & 7 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Configuration
=============

The driver can be configured by passing an ``EdgeDBClientConfig`` object
into the ``EdgeDBClient`` constructor. The client config contains immutable
settings for client behavior. You can construct a new ``EdgeDBClientConfig``
The driver can be configured by passing an ``GelClientConfig`` object
into the ``GelClientPool`` constructor. The client config contains immutable
settings for client behavior. You can construct a new ``GelClientConfig``
with the builder subclass like so:

.. code-block:: java

var builder = EdgeDBClientConfig.builder();
var builder = GelClientConfig.builder();

..

Expand Down Expand Up @@ -50,7 +50,7 @@ These are the following methods exposed on the configuration builder:
+------------------------------+-------------------------+---------------------------------------------------------------------------------------------+

This configuration object can then be passed into the constructor of
a ``EdgeDBClient``.
a ``GelClientPool``.

In addition to client-level configuration, the driver offers session-level
configuration. This type of configuration is controlled using methods prefixed
Expand All @@ -59,8 +59,8 @@ connection, pool, and client configuration.

.. code-block:: java

var client = new EdgeDBClient();
var clientPool = new GelClientPool();

var appliedGlobalClient = client.withGlobals(new HashMap<>(){{
var appliedGlobalClient = clientPool.withGlobals(new HashMap<>(){{
put("current_user_id", ...);
}});
22 changes: 11 additions & 11 deletions docs/connecting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
Connection Parameters
=====================

The ``EdgeDBClient`` constructor can consume an ``EdgeDBConnection`` class
The ``GelClientPool`` constructor can consume an ``GelConnection`` class
containing connection arguments for the client.

Most of the time, the connection arguments are implicitly resolved via
:ref:`projects <ref_intro_projects>`. In other cases, the ``EdgeDBConnection``
:ref:`projects <ref_intro_projects>`. In other cases, the ``GelConnection``
class exposes ways to construct connection arguments.

Connection builder
------------------

You can use a provided builder by calling the ``builder()`` method on
``EdgeDBConnection``
``GelConnection``

.. code-block:: java

var builder = EdgeDBConnection.builder();
var builder = GelConnection.builder();

The builder has the following methods:

Expand All @@ -45,17 +45,17 @@ The builder has the following methods:
Parse & constructor methods
---------------------------

``EdgeDBConnection`` also exposes static methods used to parse connection
``GelConnection`` also exposes static methods used to parse connection
arguments from different sources.

fromDSN
^^^^^^^

This method parses a :ref:`DSN <ref_dsn>` string into an ``EdgeDBConnection``.
This method parses a :ref:`DSN <ref_dsn>` string into an ``GelConnection``.

.. code-block:: java

var connection = EdgeDBConnection
var connection = GelConnection
.fromDSN("edgedb://user:pass@host:port/db");

fromProjectFile
Expand All @@ -66,7 +66,7 @@ This method resolves connection arguments from an ``edgedb.toml``

.. code-block:: java

var connection = EdgeDBConnection
var connection = GelConnection
.fromProjectFile("~/myproject/edgedb.toml");

fromInstanceName
Expand All @@ -76,7 +76,7 @@ This method resolves the connection arguments for a given instance name.

.. code-block:: java

var connection = EdgeDBConnection
var connection = GelConnection
.fromInstanceName("my_instance_name");

resolveEdgeDBTOML
Expand All @@ -89,7 +89,7 @@ scanned recursivly until a project file is found; if none is found, a

.. code-block:: java

var connection = EdgeDBConnection
var connection = GelConnection
.resolveEdgeDBTOML();

parse
Expand All @@ -101,6 +101,6 @@ environment variables to the connection, following the

.. code-block:: java

var connection = EdgeDBConnection
var connection = GelConnection
.parse("my_instance");

42 changes: 21 additions & 21 deletions docs/datamodeling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ by following the :ref:`scalar type map <edgedb_java_datatypes>`.
.. code-tab:: java
:caption: Java

@EdgeDBType
@GelType
public class Person {
public String name;
public int Age;
Expand Down Expand Up @@ -46,10 +46,10 @@ by following the :ref:`scalar type map <edgedb_java_datatypes>`.
There are a few requirements with the class representation:

* All classes that represent data need to be marked with the
``@EdgeDBType`` annotation.
``@GelType`` annotation.

* Any multi-link property (collection) needs to be marked with the
``@EdgeDBLinkType`` annotation.
``@GelLinkType`` annotation.

* A field must be public *or* have a valid setter if
``useFieldSetters`` is ``true`` in the client configuration.
Expand All @@ -69,7 +69,7 @@ under the interface, for example:

.. code-block:: java

var config = EdgeDBClientConfig.builder()
var config = GelClientConfig.builder()
.withNamingStrategy(NamingStrategy.snakeCase())
.build();

Expand Down Expand Up @@ -97,7 +97,7 @@ For example, creating a bean that represents the ``Person`` schema type:
.. code-tab:: java
:caption: Java

@EdgeDBType
@GelType
public class Person {
private String name;
private int age;
Expand Down Expand Up @@ -147,19 +147,19 @@ Multi-link properties

The JVM doesn't retain generic information for collection generics. To get
around this, you must specify the type of the collection with the
``@EdgeDBLinkType`` annotation.
``@GelLinkType`` annotation.

.. tabs::

.. code-tab:: java
:caption: Java

@EdgeDBType
@GelType
public class Person {
public String name;
public int age;

@EdgeDBLinkType(Person.class)
@GelLinkType(Person.class)
public List<Person> friends;
}

Expand Down Expand Up @@ -192,7 +192,7 @@ Custom deserializers
--------------------

You can specify a constructor as a target for deserialization with the
``@EdgeDBDeserializer`` annotation. A deserializer has 2 valid modes of
``@GelDeserializer`` annotation. A deserializer has 2 valid modes of
operation: enumeration consumers or value consumers.

Enumerator consumer
Expand All @@ -206,7 +206,7 @@ the name, type, and value.

.. code-block:: java

@EdgeDBType
@GelType
public class Person {
private String name;
private int age;
Expand All @@ -227,7 +227,7 @@ the name, type, and value.

}
}
} catch(EdgeDBException err) { // deserialization error
} catch(GelException err) { // deserialization error

} catch(OperationNotSupportedException err) { // read/IO error

Expand All @@ -240,9 +240,9 @@ for other data type representations, like tuples:

.. code-block:: java

@EdgeDBDeserializer
@GelDeserializer
public SimpleTuple(ObjectEnumerator enumerator)
throws EdgeDBException, OperationNotSupportedException {
throws GelException, OperationNotSupportedException {
elements = new ArrayList<>();

while(enumerator.hasRemaining()) {
Expand All @@ -261,22 +261,22 @@ Value consumers
^^^^^^^^^^^^^^^

Value consumers take in the fields' values in the constructor, mapped by a
``@EdgeDBName`` annotation:
``@GelName`` annotation:

.. tabs::

.. code-tab:: java
:caption: Java

@EdgeDBType
@GelType
public class Person {
private final String name;
private final int age;

@EdgeDBDeserializer
@GelDeserializer
public Person(
@EdgeDBName("name") String name,
@EdgeDBName("age") int age
@GelName("name") String name,
@GelName("age") int age
) {
this.name = name;
this.age = age;
Expand Down Expand Up @@ -317,17 +317,17 @@ schema types in code. For example:
.. code-tab:: java
:caption: Java

@EdgeDBType
@GelType
public abstract class Media {
public String title;
}

@EdgeDBType
@GelType
public class Show extends Media {
public Long seasons;
}

@EdgeDBType
@GelType
public class Movie extends Media {
public Long release_year;
}
Expand Down
Loading