A play client to use the orient db http api.
val config = OrientClientConfig(
url = getConfigProperty("orientdb.url"),
database = getConfigProperty("orientdb.database"),
userName = getConfigProperty("orientdb.username"),
password = getConfigProperty("orientdb.password")
)
// the actor system is provided by play
new OrientDbHttpClient(config)(actorSystem)
#Query
import de.is24.play.orientdb.client.OrientDbHttpClient
import de.is24.play.orientdb.OrientStringContext._
val name = "Hugo"
val query = gremlin"""g.V("name", $name)"""
orientDbHttpClient.select[Person](query) // requires a Json.reads
##SQL
import de.is24.play.orientdb.client.OrientDbHttpClient
import de.is24.play.orientdb.OrientStringContext._
val name = "Hugo"
val query = sql"select from Person WHERE name = $name"
orientDbHttpClient.select[Person](query) // requires a Json.reads
##Batch
import de.is24.play.orientdb.Operation._
val createLockTableBatch = Seq(
sql"Create class SchemaLock",
sql"Create property SchemaLock.id String",
sql"Create index idIndex on SchemaLock (id) UNIQUE",
sql"Insert into SchemaLock set id = $lockId, lockedBy = null"
).asBatch()
createLockTableBatch.execute
##Transaction
Seq("INSERT INTO ...", "UPDATE ...").transactionally.execute
##Functions
orientClient.callFunction("testFunction")
orientClient.callFunction("testFunction", Map[String, Any]("a" -> "42", "b" -> 42, "c" -> false))
#Release
sbt> release with-defaults