The official Java client library for EdgeDB
Find a file
2023-11-06 07:16:21 -04:00
.github/workflows run build on push, regardless of PR head 2023-06-23 11:44:11 -03:00
branding Flesh out readme (#8) 2023-06-21 22:45:42 -03:00
dbschema Fix data issues when spanning >16k bytes (#16) 2023-07-25 14:06:41 -03:00
docs add section about logging 2023-06-21 13:39:33 -03:00
examples Protocol v2 support (#17) 2023-11-01 12:53:47 -03:00
gradle/wrapper connection and client structure 2023-02-09 08:59:19 -04:00
src/driver Add MultiRange (#25) 2023-11-06 07:16:21 -04:00
tools/testgen add shared test files 2023-06-09 18:12:46 -03:00
.gitignore Restructure examples (#7) 2023-06-21 22:45:20 -03:00
build.gradle meta: 0.2.4-SNAPSHOT 2023-10-20 13:18:18 -03:00
edgedb.toml Add MultiRange (#25) 2023-11-06 07:16:21 -04:00
gradlew fix exec permission of gradlew 2023-06-09 19:24:25 -03:00
gradlew.bat connection and client structure 2023-02-09 08:59:19 -04:00
LICENSE add license 2023-06-09 18:22:35 -03:00
README.md meta: 0.2.3 2023-10-20 13:17:59 -03:00
settings.gradle Restructure examples (#7) 2023-06-21 22:45:20 -03:00

EdgeDB Java

The official Java/JVM client library for EdgeDB

Build status Discord

Installation

The Java binding is distrubuted via maven central:

Gradle

implementation 'com.edgedb:driver:0.2.3'

Maven

<dependency>
  <groupId>com.edgedb</groupId>
  <artifactId>driver</artifactId>
  <version>0.2.3</version>
</dependency>

SBT

libraryDependencies ++= Seq(
  "com.edgedb" % "driver" % "0.2.3"
)

Usage

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

import com.edgedb.driver.EdgeDBClient;

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

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

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

import com.edgedb.driver.EdgeDBClient;
import reactor.core.publisher.Mono;

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

    Mono.fromFuture(client.querySingle(String.class, "SELECT 'Hello, Java!'"))
        .doOnNext(System.out::println)
        .block();
}

This also means it plays nicely with other JVM language that support asynchronous programming via CompletionStage


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

fun main() {
    val client = EdgeDBClient()

    runBlocking {
        client.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'")
            .thenAccept { println(it) }
            .await()
    }
}

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

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

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

Examples

Some examples of using the Java client api can be found in the examples directory.

Compiling

This project uses gradle. To build the project run the following command:

./gradlew build