-
So for a personal project I'm using ArangoDB(it's like DynamoDB but with graphs) and the scala driver https://github.com/outr/scarango A // Case class to represent a person collection
case class Person(name: String, age: Int, _id: Id[Person] = Person.id()) extends Document[Person]
// We use the companion object to represent additional information about the collection
object Person extends DocumentModel[Person] {
override implicit val rw: RW[Person] = ccRW
val name: Field[String] = field("name")
val age: Field[Int] = field("age")
override def indexes: List[Index] = List(
name.index.persistent()
)
override val collectionName: String = "people"
}
// We represent our entire database here referencing all collections
object Database extends Graph("example") {
val people: DocumentCollection[Person] = vertex[Person](Person)
} So I have made a I guess this is more a Scala than a smithy question, so sorry if this is the wrong place to ask! I also tried reading this part : https://blog.indoorvivants.com/2022-06-11-smithy4s-fullstack-part-2#codecs |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I think you won't be able to make the generated class extend For This might fall out of scope for Smithy4s usage. We don't provide this level of customization of the generated code, and as far as I know it's not likely to change. |
Beta Was this translation helpful? Give feedback.
I think you won't be able to make the generated class extend
Document[Person]
directly, but you might be able to make an implicit conversion for that.For
DocumentModel[Person]
, I'd advise you to try and implementSchemaVisitor[DocumentModel]
. Still, even if it's possible, you won't be able to call e.g.Person.name
.This might fall out of scope for Smithy4s usage. We don't provide this level of customization of the generated code, and as far as I know it's not likely to change.