Restructure examples (#7)

* restructure examples

* remove hardcoded path and clean examples

* for comprehensions
This commit is contained in:
Quin Lynch 2023-06-21 22:45:20 -03:00 committed by GitHub
parent 485cf29335
commit b9ddbbbb55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 452 additions and 162 deletions

7
.gitignore vendored
View file

@ -4,6 +4,11 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/
target/
.bsp/
examples/scala-examples/lib/*
### IntelliJ IDEA ###
.idea/*
*.iws
@ -36,4 +41,4 @@ bin/
.vscode/
### Mac OS ###
.DS_Store
.DS_Store

View file

@ -0,0 +1,25 @@
plugins {
id 'java'
}
group 'com.edgedb'
version '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation project(path: ':src:driver')
implementation 'ch.qos.logback:logback-classic:1.4.5'
implementation 'ch.qos.logback:logback-core:1.4.5'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}

View file

@ -18,4 +18,4 @@ public final class BasicQueryFunctions implements Example {
.thenCompose(v -> client.queryRequiredSingle(String.class, "select 'Hello, Java!'"))
.thenAccept(result -> logger.info("queryRequiredSingle result: {}", result));
}
}
}

View file

@ -35,4 +35,4 @@ public final class CustomDeserializer implements Example {
.thenCompose(v -> client.queryRequiredSingle(Person.class, "select Person { name, age } filter .name = 'Example'"))
.thenAccept(person -> logger.info("Person result: {person}"));
}
}
}

View file

@ -6,4 +6,4 @@ import java.util.concurrent.CompletionStage;
public interface Example {
CompletionStage<Void> run(EdgeDBClient client);
}
}

View file

@ -25,4 +25,4 @@ public final class GlobalsAndConfig implements Example {
return configuredClient.queryRequiredSingle(UUID.class, "select global current_user_id")
.thenAccept(result -> logger.info("current_user_id global: {}", result));
}
}
}

View file

@ -33,4 +33,4 @@ public final class JsonResults implements Example {
})
.thenAccept(person -> logger.info("People deserialized from JSON: {}", (Object[]) person));
}
}
}

View file

@ -21,9 +21,9 @@ public final class LinkProperties implements Example {
private static final String INSERT_QUERY =
"with a := (insert Person { name := 'Person A', age := 20 } unless conflict on .name)," +
"b := (insert Person { name := 'Person B', age := 21 } unless conflict on .name)," +
"c := (insert Person { name := 'Person C', age := 22, friends := b } unless conflict on .name)" +
"insert Person { name := 'Person D', age := 23, friends := { a, b, c }, best_friend := c } unless conflict on .name";
"b := (insert Person { name := 'Person B', age := 21 } unless conflict on .name)," +
"c := (insert Person { name := 'Person C', age := 22, friends := b } unless conflict on .name)" +
"insert Person { name := 'Person D', age := 23, friends := { a, b, c }, best_friend := c } unless conflict on .name";
@Override
public CompletionStage<Void> run(EdgeDBClient client) {
@ -35,4 +35,4 @@ public final class LinkProperties implements Example {
))
.thenAccept(result -> logger.info("Person with links: {}", result));
}
}
}

View file

@ -9,31 +9,19 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.function.Supplier;
public class Main {
private static final Logger logger = LoggerFactory.getLogger(Main.class);
public static void main(String[] args) throws IOException, EdgeDBException {
var argsList = Arrays.asList(args);
var client = new EdgeDBClient(EdgeDBClientConfig.builder()
.withNamingStrategy(NamingStrategy.snakeCase())
.useFieldSetters(true)
.build()
);
).withModule("examples");
// use the example module
var exampleClient = client.withModule("examples");
if(argsList.contains("java")) {
runJavaExamples(exampleClient);
}
if(argsList.contains("kotlin")) {
com.edgedb.examples.KotlinMain.Companion.runExamples(exampleClient);
}
runJavaExamples(client);
logger.info("Examples complete");
}

View file

@ -29,4 +29,4 @@ public final class QueryResults implements Example {
.thenCompose(v -> client.queryRequiredSingle(Person.class, "select Person { name, age } filter .name = 'Example'"))
.thenAccept(result -> logger.info("Person returned from query: {}", result));
}
}
}

View file

@ -18,4 +18,4 @@ public final class Transactions implements Example {
logger.info("Result from transaction: {}", result);
});
}
}
}

View file

@ -4,32 +4,20 @@ plugins {
}
group 'com.edgedb'
version '1.0-SNAPSHOT'
sourceSets.main {
java.srcDirs("src/main/java", "src/main/kotlin")
}
version '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
implementation project(path: ':src:driver')
implementation 'ch.qos.logback:logback-classic:1.4.5'
implementation 'ch.qos.logback:logback-core:1.4.5'
implementation 'org.jooq:joou:0.9.4'
implementation 'org.reflections:reflections:0.10.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
implementation 'ch.qos.logback:logback-classic:1.4.5'
implementation 'ch.qos.logback:logback-core:1.4.5'
}
jar.duplicatesStrategy = DuplicatesStrategy.EXCLUDE
@ -39,7 +27,6 @@ test {
useJUnitPlatform()
}
compileKotlin {
destinationDirectory = compileJava.destinationDirectory
kotlinOptions {
jvmTarget = "1.8"
}

View file

@ -4,11 +4,10 @@ import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.annotations.EdgeDBType
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
import java.util.concurrent.CompletionStage
class KotlinAbstractTypes : KotlinExample {
class AbstractTypes : Example {
companion object {
private val logger = LoggerFactory.getLogger(KotlinExample::class.java)!!
private val logger = LoggerFactory.getLogger(AbstractTypes::class.java)!!
}
@EdgeDBType
@ -28,7 +27,7 @@ class KotlinAbstractTypes : KotlinExample {
override suspend fun runAsync(client: EdgeDBClient) {
client.execute(
"""insert Movie {
"""insert Movie {
title := "The Matrix",
release_year := 1999
} unless conflict on .title;
@ -39,8 +38,8 @@ class KotlinAbstractTypes : KotlinExample {
).await()
val results = client.query(
Media::class.java,
"""select Media {
Media::class.java,
"""select Media {
title,
[is Movie].release_year,
[is Show].seasons
@ -50,13 +49,13 @@ class KotlinAbstractTypes : KotlinExample {
for(result in results) {
if(result is Show) {
logger.info(
"Got show: title: {}, seasons: {}",
result.title, result.seasons
"Got show: title: {}, seasons: {}",
result.title, result.seasons
)
} else if(result is Movie) {
logger.info(
"Got movie: title: {}, release year: {}",
result.title, result.releaseYear
"Got movie: title: {}, release year: {}",
result.title, result.releaseYear
)
}
}

View file

@ -4,9 +4,9 @@ import com.edgedb.driver.EdgeDBClient
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
class KotlinBasicQueries : KotlinExample {
class BasicQueries : Example {
companion object {
private val logger = LoggerFactory.getLogger(KotlinBasicQueries::class.java)!!
private val logger = LoggerFactory.getLogger(BasicQueries::class.java)!!
}
override suspend fun runAsync(client: EdgeDBClient) {

View file

@ -7,23 +7,23 @@ import com.edgedb.driver.annotations.EdgeDBType
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
class KotlinCustomDeserializer : KotlinExample {
class CustomDeserializer : Example {
companion object {
private val logger = LoggerFactory.getLogger(KotlinCustomDeserializer::class.java)!!
private val logger = LoggerFactory.getLogger(CustomDeserializer::class.java)!!
}
@EdgeDBType
data class Person
@EdgeDBDeserializer
constructor (
@EdgeDBName("name")
val name: String,
@EdgeDBName("age")
val age: Long
) {
init {
logger.info("Custom deserializer called with: name: {}, age: {}", name, age)
}
@EdgeDBDeserializer
constructor (
@EdgeDBName("name")
val name: String,
@EdgeDBName("age")
val age: Long
) {
init {
logger.info("Custom deserializer called with: name: {}, age: {}", name, age)
}
}
override suspend fun runAsync(client: EdgeDBClient) {

View file

@ -2,6 +2,6 @@ package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
interface KotlinExample {
interface Example {
suspend fun runAsync(client: EdgeDBClient)
}

View file

@ -6,19 +6,19 @@ import org.slf4j.LoggerFactory
import java.time.Duration
import java.util.*
class KotlinGlobalsAndConfig : KotlinExample {
class GlobalsAndConfig : Example {
companion object {
private val logger = LoggerFactory.getLogger(KotlinExample::class.java)!!
private val logger = LoggerFactory.getLogger(GlobalsAndConfig::class.java)!!
}
override suspend fun runAsync(client: EdgeDBClient) {
val configuredClient = client
.withConfig { config -> config
.withIdleTransactionTimeout(Duration.ZERO)
.applyAccessPolicies(true)
.withIdleTransactionTimeout(Duration.ZERO)
.applyAccessPolicies(true)
}
.withGlobals(mapOf(
"current_user_id" to UUID.randomUUID()
"current_user_id" to UUID.randomUUID()
))
val currentUserId = configuredClient.queryRequiredSingle(

View file

@ -6,10 +6,9 @@ import com.edgedb.driver.annotations.EdgeDBType
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
class KotlinLinkProperties : KotlinExample {
class LinkProperties : Example {
companion object {
private val logger = LoggerFactory.getLogger(KotlinLinkProperties::class.java)
private val logger = LoggerFactory.getLogger(LinkProperties::class.java)
private const val INSERT_QUERY = """
with
a := (insert Person { name := 'Person A', age := 20 } unless conflict on .name),

View file

@ -0,0 +1,41 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.EdgeDBClientConfig
import com.edgedb.driver.namingstrategies.NamingStrategy
import kotlinx.coroutines.runBlocking
import org.slf4j.LoggerFactory
object Main {
private val logger = LoggerFactory.getLogger(Main::class.java)
@JvmStatic
fun main(args: Array<String>) {
val client = EdgeDBClient(EdgeDBClientConfig.builder()
.withNamingStrategy(NamingStrategy.snakeCase())
.useFieldSetters(true)
.build()
).withModule("examples")
val examples = listOf(
AbstractTypes(),
BasicQueries(),
CustomDeserializer(),
GlobalsAndConfig(),
LinkProperties(),
Transactions()
)
runBlocking {
for (example in examples) {
logger.info("Running Kotlin example {}...", example)
try {
example.runAsync(client)
logger.info("Kotlin example {} complete!", example)
} catch (x: Exception) {
logger.error("Failed to run Kotlin example {}", example, x)
}
}
}
}
}

View file

@ -4,9 +4,9 @@ import com.edgedb.driver.EdgeDBClient
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
class KotlinTransactions : KotlinExample {
class Transactions : Example {
companion object {
private val logger = LoggerFactory.getLogger(KotlinTransactions::class.java)
private val logger = LoggerFactory.getLogger(Transactions::class.java)
}
override suspend fun runAsync(client: EdgeDBClient) {

View file

@ -0,0 +1,21 @@
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "3.1.3"
//resolvers += Resolver.file("my-test-repo", file("test"))
libraryDependencies ++= Seq(
"com.edgedb" % "driver" % "0.0.1" from "file:///" + System.getProperty("user.dir") + "/lib/com.edgedb.driver-0.0.1-SNAPSHOT.jar",
"ch.qos.logback" % "logback-classic" % "1.4.7",
"ch.qos.logback" % "logback-core" % "1.4.7",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.15.1",
"io.netty" % "netty-all" % "4.1.89.Final",
"org.jooq" % "joou" % "0.9.4",
"org.reflections" % "reflections" % "0.10.2"
)
lazy val root = (project in file("."))
.settings(
name := "scala-examples",
idePackagePrefix := Some("com.edgedb.examples")
)

View file

@ -0,0 +1 @@
sbt.version = 1.9.0

View file

@ -0,0 +1 @@
addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1")

View file

@ -0,0 +1,62 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.annotations.EdgeDBType
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import scala.concurrent.{Await, ExecutionContext, Future}
object AbstractTypes:
@EdgeDBType
abstract class Media:
var title: String = _
@EdgeDBType
class Movie extends Media:
var releaseYear: Long = _
@EdgeDBType
class Show extends Media:
var seasons: Long = _
class AbstractTypes extends Example:
private val logger = LoggerFactory.getLogger(classOf[AbstractTypes])
import scala.jdk.FutureConverters._
import AbstractTypes._
override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
for {
result <- client.query(
classOf[Media],
"""
| insert Movie {
| title := "The Matrix",
| release_year := 1999
| } unless conflict on .title;
| insert Show {
| title := "The Office",
| seasons := 9
| } unless conflict on .title;
| select Media {
| title,
| [is Movie].release_year,
| [is Show].seasons
|}""".stripMargin).asScala
} yield {
result.forEach {
case movie: Movie =>
logger.info(
"Got movie: title: {}, release year: {}",
movie.title, movie.releaseYear
)
case show: Show =>
logger.info(
"Got show: title: {}, seasons: {}",
show.title, show.seasons
)
case unknown => logger.warn("Got unknown result type: {}", unknown)
}
}
}

View file

@ -0,0 +1,22 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
import scala.jdk.FutureConverters.*
class BasicQueryFunctions extends Example:
private val logger = LoggerFactory.getLogger(classOf[BasicQueryFunctions])
override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
for {
queryResult <- client.query(classOf[String], "SELECT 'Hello, Scala!'").asScala
querySingleResult <- client.querySingle(classOf[String], "SELECT 'Hello, Scala!'").asScala
queryRequiredSingleResult <- client.queryRequiredSingle(classOf[String], "SELECT 'Hello, Scala!'").asScala
}
yield (queryResult, querySingleResult, queryRequiredSingleResult) {
logger.info("'query' method result: {}", queryResult)
logger.info("'querySingle' method result: {}", querySingleResult)
logger.info("'queryRequiredSingle' method result: {}", queryRequiredSingleResult)
0
}
}

View file

@ -0,0 +1,38 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.annotations.{EdgeDBDeserializer, EdgeDBName, EdgeDBType}
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
import scala.jdk.FutureConverters.*
object CustomDeserializer:
private val logger = LoggerFactory.getLogger(classOf[CustomDeserializer])
@EdgeDBType
class Person @EdgeDBDeserializer()
(
@EdgeDBName("name")
val name: String,
@EdgeDBName("age")
val age: Long
) {
logger.info("Custom deserializer called")
}
class CustomDeserializer extends Example:
import CustomDeserializer._
override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
for(
result <- client.queryRequiredSingle(
classOf[Person],
"""
| insert Person { name := 'Example', age := 123 } unless conflict on .name;
| select Person { name, age } filter .name = 'Example'
|""".stripMargin
).asScala
) yield {
logger.info("Got person: name: {}, age: {}", result.name, result.age)
}
}

View file

@ -0,0 +1,8 @@
package com.edgedb.examples
import scala.concurrent.{ExecutionContext, Future}
import com.edgedb.driver.EdgeDBClient
trait Example {
def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit];
}

View file

@ -0,0 +1,36 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.Consumer
import com.edgedb.driver.state.Config
import org.slf4j.LoggerFactory
import java.time.Duration
import java.util.UUID
import scala.concurrent.{ExecutionContext, Future}
import scala.jdk.CollectionConverters.MapHasAsJava
import scala.jdk.FutureConverters.*
class GlobalsAndConfig extends Example:
private val logger = LoggerFactory.getLogger(classOf[GlobalsAndConfig])
override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
val configuredClient = client.withConfig(Config.builder()
.withQueryExecutionTimeout(Duration.ZERO)
.applyAccessPolicies(true)
.build()
).withGlobals(
Map[String, Object](
"current_user_id" -> UUID.randomUUID()
).asJava
)
for(
result <- configuredClient.queryRequiredSingle(
classOf[UUID],
"SELECT GLOBAL current_user_id"
).asScala
) yield {
logger.info("Current user ID: {}", result)
}
}

View file

@ -0,0 +1,62 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import com.edgedb.driver.annotations.{EdgeDBLinkType, EdgeDBType}
import org.slf4j.LoggerFactory
import java.util
import scala.concurrent.{ExecutionContext, Future}
import scala.jdk.FutureConverters.*
object LinkProperties:
@EdgeDBType
class Person:
var name: String = _
var age: Long = _
var bestFriend: Person = _
@EdgeDBLinkType(classOf[Person])
var friends: util.Collection[Person] = _
class LinkProperties extends Example:
private val logger = LoggerFactory.getLogger(classOf[LinkProperties])
import LinkProperties.Person
override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
for(
result <- client.queryRequiredSingle(
classOf[Person],
"""
| with
| a := (insert Person { name := 'Person A', age := 20 } unless conflict on .name),
| b := (insert Person { name := 'Person B', age := 21 } unless conflict on .name),
| c := (insert Person { name := 'Person C', age := 22, friends := b } unless conflict on .name)
| insert Person {
| name := 'Person D',
| age := 23,
| friends := {
| a,
| b,
| c
| },
| best_friend := c
| } unless conflict on .name;
| select Person {
| name,
| age,
| friends: {
| name,
| age,
| friends
| },
| best_friend: {
| name,
| age,
| friends
| }
| } filter .name = 'Person D'
|""".stripMargin
).asScala
) yield {
logger.info("Person with links: {}", result)
}
}

View file

@ -0,0 +1,48 @@
package com.edgedb.examples
import com.edgedb.driver.namingstrategies.NamingStrategy
import com.edgedb.driver.{EdgeDBClient, EdgeDBClientConfig, Transaction}
import org.slf4j.{Logger, LoggerFactory}
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future, blocking}
import scala.util.control.NonFatal
import ExecutionContext.Implicits.global
@main
def main(): Unit = {
val logger = LoggerFactory.getLogger("Main")
val client = new EdgeDBClient(EdgeDBClientConfig.builder
.withNamingStrategy(NamingStrategy.snakeCase)
.useFieldSetters(true)
.build
).withModule("examples")
val examples = List(
AbstractTypes(),
BasicQueryFunctions(),
CustomDeserializer(),
GlobalsAndConfig(),
LinkProperties(),
Transactions()
)
for (example <- examples)
Await.ready(runExample(logger, client, example), Duration.Inf)
logger.info("Examples complete!")
}
private def runExample(logger: Logger, client: EdgeDBClient, example: Example)(implicit context: ExecutionContext): Future[Unit] = {
logger.info("Running Scala example {}...", example)
example.run(client)
.map({ * =>
logger.info(s"Scala example {} complete!", example)
})
.recoverWith { e =>
logger.error(s"Failed to run Scala example {}", example, e)
Future {}
}
}

View file

@ -0,0 +1,18 @@
package com.edgedb.examples
import com.edgedb.driver.{EdgeDBClient, Transaction}
import org.slf4j.LoggerFactory
import scala.jdk.FutureConverters.*
import scala.concurrent.{ExecutionContext, Future}
class Transactions extends Example {
private val logger = LoggerFactory.getLogger(classOf[Transactions])
override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
client.transaction((tx: Transaction) => {
logger.info("In transaction")
tx.queryRequiredSingle(classOf[String], "select 'Result from Transaction'")
}).asScala.map{ result =>
logger.info("Result from transaction: {}", result)
}
}
}

View file

@ -1,13 +0,0 @@
module com.edgedb.examples {
requires com.edgedb.driver;
requires org.slf4j;
requires org.jooq.joou;
requires org.reflections;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires kotlin.stdlib;
requires kotlinx.coroutines.core;
exports com.edgedb.examples;
}

View file

@ -1,34 +0,0 @@
package com.edgedb.examples
import com.edgedb.driver.EdgeDBClient
import kotlinx.coroutines.runBlocking
import org.slf4j.LoggerFactory
class KotlinMain {
companion object {
private val logger = LoggerFactory.getLogger(KotlinMain::class.java)
fun runExamples(client: EdgeDBClient) {
val examples = listOf(
KotlinAbstractTypes(),
KotlinBasicQueries(),
KotlinCustomDeserializer(),
KotlinGlobalsAndConfig(),
KotlinLinkProperties(),
KotlinTransactions()
)
runBlocking {
for(example in examples) {
logger.info("Running Kotlin example {}...", example)
try {
example.runAsync(client)
logger.info("Kotlin example {} complete!", example)
} catch (x: Exception) {
logger.error("Failed to run Kotlin example {}", example, x)
}
}
}
}
}
}

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Log level: OFF, ERROR, WARN, INFO, DEBUG, TRACE, ALL -->
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss} [%thread] %class{0} %M : %msg%n</Pattern>
</layout>
</appender>
<appender name="APPEND" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
<includeCallerData>true</includeCallerData>
</appender>
<logger name="nio2.ssl.SSLEngineAutomat" level="ALL" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="nio2.ssl.SSLAsynchronousSocketChannel" level="ALL" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="nio2.ssl.SSLAsynchronousSocketChannelLayer" level="ALL" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="nio2.ssl.SSLAsynchronousSocketChannelImpl" level="ALL" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="nio2.ssl.SSLAsynchronousChannelGroup" level="ALL" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<root level="ALL">
<appender-ref ref="APPEND" />
</root>
</configuration>

View file

@ -1,6 +1,7 @@
rootProject.name = 'edgedb-java'
include 'examples'
include 'src:driver'
include 'tools'
include 'tools:testgen'
include 'examples:java-examples'
include 'examples:kotlin-examples'

View file

@ -1,3 +1,5 @@
import java.nio.file.Paths
dependencies {
api "com.fasterxml.jackson.core:jackson-core:$jackson_version"
api "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
@ -30,6 +32,14 @@ jar {
'Automatic-Module-Name': 'com.edgedb.driver'
}
}
tasks.register('copyJarToBin') {
copy {
from jar
into Paths.get(project.rootDir.toString(), 'examples', 'scala-examples', 'lib')
}
}
publishing {
publications {
mavenJava(MavenPublication) {

View file

@ -342,7 +342,6 @@ public class TypeDeserializerInfo<T> {
// if there's a set method that isn't ignored, with the same type, use it.
var setMethod = setters.get(field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1));
if(setMethod == null) {
setMethod = setters.get(field.getName());
}