The official Java client library for EdgeDB
Find a file
2023-06-23 11:44:11 -03: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 more examples. link property support. pooled client 2023-04-04 08:38:15 -03:00
docs add section about logging 2023-06-21 13:39:33 -03:00
examples Restructure examples (#7) 2023-06-21 22:45:20 -03:00
gradle/wrapper connection and client structure 2023-02-09 08:59:19 -04:00
src/driver Restructure examples (#7) 2023-06-21 22:45:20 -03: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 0.1.1 snapshot 2023-06-19 14:34:43 -03:00
edgedb.toml fixes and complete tests 2023-05-19 17:14:43 -03: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 Flesh out readme (#8) 2023-06-21 22:45:42 -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 'org.edgedb:edgedb:0.1.0'

Maven

<dependency>
  <groupId>org.edgedb</groupId>
  <artifactId>edgedb</artifactId>
  <version>0.1.0</version>
</dependency>

SBT

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

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 CompletionState 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