Coder Social home page Coder Social logo

edgedb-java's Introduction

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.3.0'

Maven

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

SBT

libraryDependencies ++= Seq(
  "com.edgedb" % "driver" % "0.3.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 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

edgedb-java's People

Contributors

quinchs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.