Last active
February 3, 2026 20:21
-
-
Save dacr/7a91c7d787e7edc7bcc808b4cfb2e13c to your computer and use it in GitHub Desktop.
neo4j through neotypes - hello world / published by https://github.com/dacr/code-examples-manager #d4502d74-9ade-4fca-a400-12d1e7e18a13/5f3ada5cb7a8f16a80378d9986314a06f49bc51a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : neo4j through neotypes - hello world | |
| // keywords : scala, scalatest, neo4j, neotypes, helloworld, cypher, dsl, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // id : d4502d74-9ade-4fca-a400-12d1e7e18a13 | |
| // created-on : 2024-06-25T15:10:56+02:00 | |
| // managed-by : https://github.com/dacr/code-examples-manager | |
| // run-with : scala-cli $file | |
| // --------------------- | |
| //> using scala "3.4.2" | |
| //> using dep io.github.neotypes::neotypes-core:1.1.0 | |
| //> using dep org.neo4j.test:neo4j-harness:5.20.0 | |
| // --------------------- | |
| import neotypes.GraphDatabase | |
| import neotypes.mappers.ResultMapper | |
| import neotypes.syntax.all.* | |
| import org.neo4j.driver.AuthTokens | |
| import scala.util.Using | |
| import scala.concurrent.{Await, Future} | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.concurrent.duration._ | |
| val builder = | |
| org.neo4j.harness.Neo4jBuilders | |
| .newInProcessBuilder() | |
| Using(builder.build()) { embedded => | |
| val driver = GraphDatabase.asyncDriver[Future](embedded.boltURI(), AuthTokens.none()) | |
| val message = "RETURN 'hello world'".query(ResultMapper.string).single(driver) | |
| Await.result(message.map(msg => println(msg)), 5.seconds) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment