Skip to content

Commit

Permalink
opt-in auto MacroBsonFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
SakulK committed Sep 25, 2024
1 parent 90fa751 commit 60d3ff0
Show file tree
Hide file tree
Showing 22 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import scala.deriving.*
import scala.annotation.experimental

trait MacroBsonFormatDeriving:
transparent implicit inline def derivedAuto[A]: MacroBsonFormat[A] = ${
MacroBsonFormatDerivingImpl.genAuto[A]
}

transparent inline def derived[A]: MacroBsonFormat[A] = ${
MacroBsonFormatDerivingImpl.gen[A]
}

object MacroBsonFormatAuto:
transparent implicit inline def derivedAuto[A]: MacroBsonFormat[A] = ${
MacroBsonFormatDerivingImpl.genAuto[A]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples
import munit.FunSuite
import me.sgrouples.rogue.cc.macros.MacroBsonFormat
import me.sgrouples.rogue.cc.macros.MacroBsonFormat.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import org.bson.types.ObjectId
import java.time.LocalDateTime
import java.time.temporal.ChronoUnit
Expand Down
1 change: 1 addition & 0 deletions cc/src/test/scala/me/sgrouples/rogue/AsyncBatchSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples.rogue
import java.util.concurrent.atomic.AtomicInteger
import me.sgrouples.rogue.cc.MongoTestConn
import me.sgrouples.rogue.cc.macros._
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.cc.CcRogue._
import munit.FunSuite

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.sgrouples.rogue
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.cc.*
import org.bson.BsonDocument
import org.bson.types.ObjectId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples.rogue.cc
import munit.FunSuite
import org.mongodb.scala.MongoDatabase
import me.sgrouples.rogue.cc.macros._
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.cc.CcRogue._

import scala.concurrent.Future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples.rogue.cc
import me.sgrouples.rogue.*
import me.sgrouples.rogue.cc.CcRogue.{given, *}
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import org.bson.types.ObjectId
import munit.FunSuite
import me.sgrouples.rogue.QueryParser.*
Expand Down
1 change: 1 addition & 0 deletions cc/src/test/scala/me/sgrouples/rogue/cc/CcMetaSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples.rogue.cc
import org.bson.types.ObjectId
import munit.FunSuite
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import com.softwaremill.tagging.*

case class IdOneEnum(_id: ObjectId, one: String, en: VenueStatus.Value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import java.time.temporal.{ChronoUnit}
import org.bson.types.ObjectId
import munit.FunSuite
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import com.softwaremill.tagging.*

trait User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import munit.FunSuite
import CcRogue._
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.CcRogue.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*

object EnumIdFieldEnum extends Enumeration {
val one: Value = Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.bson.types.ObjectId
import munit.FunSuite
import me.sgrouples.rogue.cc.CcRogue.*
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*

import scala.concurrent.ExecutionContext.Implicits.global
case class Cont(_id: ObjectId, lst: Seq[ObjectId])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.sgrouples.rogue.cc

import munit.FunSuite
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.map.MapKeyFormat
import org.bson.types.ObjectId
import com.softwaremill.tagging.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.util.UUID

import io.fsq.rogue._
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.cc
import org.bson.types.ObjectId
import munit.FunSuite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples.rogue.cc
import org.bson.types.ObjectId
import me.sgrouples.rogue._
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.cc.Metas.VenueRMeta
import me.sgrouples.rogue.cc.CcRogue.*
import munit.FunSuite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.sgrouples.rogue.cc

import munit.FunSuite
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import com.softwaremill.tagging.*
import org.bson.types.ObjectId
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.sgrouples.rogue.cc
import java.time.Instant

import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import org.bson.types.ObjectId
import munit.FunSuite
trait QueryById[M] {
Expand Down
1 change: 1 addition & 0 deletions cc/src/test/scala/me/sgrouples/rogue/cc/TestModels.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.sgrouples.rogue.cc
import io.fsq.rogue.index.{Asc, Desc, IndexBuilder, Text}
import me.sgrouples.rogue.cc.macros.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.*
import me.sgrouples.rogue.naming.PluralLowerCase
import org.bson.types.ObjectId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.sgrouples.rogue.cc.macros
import munit.FunSuite
import me.sgrouples.rogue.cc.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*

case class CArrays(bytes: Array[Byte], strings:Array[String])

Expand Down
1 change: 1 addition & 0 deletions cc/src/test/scala/me/sgrouples/rogue/cc/macros/Metas.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import me.sgrouples.rogue.cc.CcRogue.{given, *}
import me.sgrouples.rogue.naming.PluralLowerCase
import org.bson.types.ObjectId
import com.softwaremill.tagging.*
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*

import java.time.Instant
import java.util.{Currency, Locale, UUID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.time.temporal.ChronoUnit

import me.sgrouples.rogue.cc._
import me.sgrouples.rogue.cc.macros._
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import org.bson.types.ObjectId
import munit.FunSuite
import com.softwaremill.tagging.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.sgrouples.rogue.macrotests

import me.sgrouples.rogue.cc.CustomKey
import me.sgrouples.rogue.cc.macros._
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import me.sgrouples.rogue.macrotests.Domain.StrLongMapT
import org.bson.types.ObjectId
import com.softwaremill.tagging.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.sgrouples.rogue.macrotests

import me.sgrouples.rogue.cc.{QueryFieldHelpers, TestDomainObject}
import me.sgrouples.rogue.cc.macros._
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import munit.FunSuite
import scala.concurrent.Future
import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.sgrouples.rogue.naming

import me.sgrouples.rogue.cc.macros._
import me.sgrouples.rogue.cc.macros.MacroBsonFormatAuto.*
import munit.FunSuite

/** Created by mwielocha on 09/08/16.
Expand Down

0 comments on commit 60d3ff0

Please sign in to comment.