proteus

Scala driver for ArangoDB

License

License

GroupId

GroupId

com.charlesahunt
ArtifactId

ArtifactId

proteus_2.12
Last Version

Last Version

0.6.7
Release Date

Release Date

Type

Type

jar
Description

Description

proteus
Scala driver for ArangoDB
Project URL

Project URL

https://github.com/CharlesAHunt/proteus
Project Organization

Project Organization

com.charlesahunt
Source Code Management

Source Code Management

https://github.com/CharlesAHunt/proteus

Download proteus_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.charlesahunt/proteus_2.12/ -->
<dependency>
    <groupId>com.charlesahunt</groupId>
    <artifactId>proteus_2.12</artifactId>
    <version>0.6.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.charlesahunt/proteus_2.12/
implementation 'com.charlesahunt:proteus_2.12:0.6.7'
// https://jarcasting.com/artifacts/com.charlesahunt/proteus_2.12/
implementation ("com.charlesahunt:proteus_2.12:0.6.7")
'com.charlesahunt:proteus_2.12:jar:0.6.7'
<dependency org="com.charlesahunt" name="proteus_2.12" rev="0.6.7">
  <artifact name="proteus_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.charlesahunt', module='proteus_2.12', version='0.6.7')
)
libraryDependencies += "com.charlesahunt" % "proteus_2.12" % "0.6.7"
[com.charlesahunt/proteus_2.12 "0.6.7"]

Dependencies

compile (8)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.6
ch.qos.logback : logback-classic jar 1.1.7
com.typesafe.scala-logging : scala-logging_2.12 jar 3.5.0
org.scalaj : scalaj-http_2.12 jar 2.3.0
com.typesafe : config jar 1.3.1
io.circe : circe-core_2.12 jar 0.6.1
io.circe : circe-generic_2.12 jar 0.6.1
io.circe : circe-parser_2.12 jar 0.6.1

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.1

Project Modules

There are no modules declared in this project.

Proteus

Latest version Maven Central Proteus Codacy Badge Codacy Badge

ArangoDB driver for Scala.

The word 'Proteus' comes the adjective protean, with the general meaning of "versatile", "mutable", "capable of assuming many forms". "Protean" has positive connotations of flexibility, versatility and adaptability. The name Proteus is a nod to the versatile and many-formed nature of ArangoDB.

This driver is compatible with ArangoDB v3.6.x

Getting Started

You may need to add the Sonatype nexus to your resolvers:

     resolvers ++= Seq("OSS" at "http://oss.sonatype.org/content/repositories/releases")

sbt:

    libraryDependencies += "com.cornfluence" % "proteus_2.13" % "0.7.3"

maven:

    <dependency>
      <groupId>com.cornfluence</groupId>
      <artifactId>proteus_2.13</artifactId>
      <version>0.7.3</version>
      <classifier>sources</classifier>
    </dependency>

Note: Versions of Proteus greater than 0.7.0 are for ArangoDB 3.6.+ and built with Scala 2.13

Configuration

To configure your application's ArangoDB user, you will need to create a ProteusConfig configuration object to initialize the document and graph clients. You will most likely want to materialize the configuration case class from an application.conf that looks like the following so you can materialize it to a case class using Config.configuration in your calling code:

    proteus {
        host = "localhost"
        user = "root"
        password = "openSesame"
        port = "8529",
        tls = false
    }

You can also create the ProteusConfig manually in your source like so:

    ProteusConfig(
      host: String = "localhost",
      user: String,
      password: String,
      port: String = "8529",
      tls: Boolean = false
    )

Examples

Client API

    val arangoClient = ArangoClient(config = ProteusConfig(...))

    val documentClient = DocumentClient(config = ProteusConfig(...), databaseName = "testDB")
            
    val graphClient = GraphClient(config = ProteusConfig(...), graphName = "testGraph")

Database API

Create a database:

    arangoClient.createDatabase("dbName", List(User(username = "user", password = "pass", active = true)))
    
    arangoClient.getDatabaseList
    
    arangoClient.getCurrentDatabase

Delete a database:

   arangoClient.deleteDatabase("dbName")
           

Collection API

    arangoClient.createCollection("dbName", testCollection)
    
    arangoClient.dropCollection("dbName", testCollection)

Document API

Create a document (returning the document id as a string):

    documentClient.createDocument("testCollection","""{ "Hello": "World" }""")

Fetch all documents:

    documentClient.getAllDocuments("testCollection")

Fetch a single document:

    documentClient.getDocument("testCollection", "documentID")

Update/Replace a document:

    documentClient.replaceDocument("testCollection", "documentID","""{ "Hello": "World" }""")

Remove a document:

    documentClient.deleteDocument("testCollection", "documentID")

Graph API

(Graph API is still under some development)

Create a graph

    graphClient.createGraph(List())

Drop a graph

    graphClient.dropGraph()

Create a vertex collection

    graphClient.createVertexCollection("vertexCollectionName")

Create an edge collection

    graphClient.createEdgeCollection("edgeCollectionName", List("vertexCollectionName"), List("otherVertexCollectionName"))

Create a vertex

    graphClient.createVertex("vertexCollectionName", """{"free":"style"}""")

Create an edge

    graphClient.createEdge("edgeCollectionName", "typeName", "vertexOneID", "vertexTwoID")

Delete an edge

    graphClient.deleteEdge("edgeCollectionName", "edgeKey")

Delete an edge collection

    graphClient.deleteEdgeCollection("edgeCollectionName")

Delete a vertex

    graphClient.deleteVertex("vertexCollectionName", "vertexKey")

Delete a vertex collection

    graphClient.deleteVertexCollection("vertexCollectionName")

Versions

Version
0.6.7