Feature: parameter mapper for case classes
See original GitHub issueRight now, we do not support case classes as parameters on a Cypher query. However, I think this would be very useful.
For example, consider the following case class.
final case class User(name: String, age: Int, ...) // Many more fields.
Then, as the number of fields grow, having to write something like this, becomes more & more tedious.
val user = User("Luis", 22, ...)
c"CREATE (user: User { name: ${user.name}, age: ${user.age}, ... })"
Rather, I would like to write it like this:
c"CREATE (user: User { $user })"
Or even:
c"CREATE $user"
Before diving in the implementation, I would like to see what others think about this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Scala case class to map - Medium
Case classes in scala are like regular classes which can hold plain and immutable data objects. Case classes comes with following features.
Read more >Case Classes | Tour of Scala
Case classes are good for modeling immutable data. ... When you create a case class with parameters, the parameters are public val s....
Read more >Case class to map in Scala - Stack Overflow
Currently I'm working on a Scala server and defining the protocol and all its messages and exceptions using case classes, as they are...
Read more >9. Objects, Case Classes, and Traits - Learning Scala [Book]
A popular use of self types is to add functionality with traits to classes that require input parameters. A trait cannot easily extend...
Read more >Scala | Case Class and Case Object - GeeksforGeeks
A Case Class is just like a regular class, which has a feature for modeling unchangeable data. It is also constructive in pattern...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Recently @SystemFw assisted with the shapeless part.
I will contribute a version soon.
This is what I’m doing in my project to achieve this kind of functionality. There’s surely a more elegant way to achieve this, and it is by no means complete, but this allows the generation of cypher strings to create nodes from arbitrary case classes: