io.github.mbannour.fields
package io.github.mbannour.fields
Members list
Type members
Classlikes
object MongoFieldMapper
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MongoFieldMapper.type
trait MongoFieldResolver
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
object MongoPath
Macro-powered extractor for case-class field paths that map to MongoDB document keys.
Macro-powered extractor for case-class field paths that map to MongoDB document keys.
Core ideas:
- Accepts a selector lambda like
_.address.zipCodeand returns a dot-separated path (e.g. "address.zip"). - Honors
@BsonPropertyon constructor parameters and uses the overridden name when present. - Supports a transparent hop over
Optionvia the.?syntax imported fromMongoPath.syntax.
Usage: import io.github.mbannour.fields.MongoPath import io.github.mbannour.fields.MongoPath.syntax.?
case class Address(street: String, @BsonProperty("zip") zipCode: Int) case class User(address: Option[Address])
MongoPath.ofUser // "address" MongoPath.ofUser // "address.zip"
Notes:
- The
.?method is never executed at runtime; it only helps the lambda typecheck and be recognized by the macro. - If the macro cannot detect a valid case-class field selection chain, it will abort compilation with an error.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MongoPath.type
In this article