You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE TYPE finance.currency AS ENUM ('USD', 'EUR', 'GBP', 'KM');
I have created a composite type to represent this currency value in the database.
caseclassDBCurrencyValue2(
value: Double,
currency: CurrencyType
) extendsStruct//I have added this to the MyPostgresAPIimplicitvalfMapperCurrencyType:JdbcType[CurrencyType] = createEnumJdbcType[CurrencyType]("finance.currency", _.toString, s =>CurrencyType.valueOf(s), quoteName =false)
implicitvalfListTypeMapperCurrencyType:JdbcType[List[CurrencyType]] = createEnumListJdbcType[CurrencyType]("finance.currency", _.toString, s =>CurrencyType.valueOf(s), quoteName =false)
implicitvalfColumnExtensionMethodsBuilderCurrencyType:Rep[CurrencyType] =>EnumColumnExtensionMethods[CurrencyType, CurrencyType] = createEnumColumnExtensionMethodsBuilder[CurrencyType]
implicitvalfOptionColumnExtensionMethodsBuilderCurrencyType:Rep[Option[CurrencyType]] =>EnumColumnExtensionMethods[CurrencyType, Option[CurrencyType]] = createEnumOptionColumnExtensionMethodsBuilder[CurrencyType]
And composite support:
implicitvalcompositeWeSeeCommissionTypeMapper:GenericJdbcType[DBCurrencyValue2] = createCompositeJdbcType[DBCurrencyValue2]("finance.currency_value")
But when I try to compile this, I get this compile error (Scala 3):
/Users/technobug/razvoj/bbeacon/src/main/scala/logic/services/database/mappings/MyPostgresProfile.scala:52:91
No given instance of type com.github.tminglei.slickpg.TokenConverter[
com.technobug.brzina.bot.libs.protocol.data.CurrencyType] was found.
I found:
MyPostgresProfile.this.baseConverter[
com.technobug.brzina.bot.libs.protocol.data.CurrencyType](
/* missing */
summon[
com.github.tminglei.slickpg.utils.RegisteredTypeConverter[String,
com.technobug.brzina.bot.libs.protocol.data.CurrencyType]
]
,
???)
But no implicit values were found that match type com.github.tminglei.slickpg.utils.RegisteredTypeConverter[String,
com.technobug.brzina.bot.libs.protocol.data.CurrencyType].
implicit val compositeWeSeeCommissionTypeMapper2: GenericJdbcType[DBCurrencyValue2] = createCompositeJdbcType[DBCurrencyValue2]("finance.currency_value")
I have a straightforward data structure to represent the value of a currency.
I represent CurrencyType in the database as
CREATE TYPE finance.currency AS ENUM ('USD', 'EUR', 'GBP', 'KM');
I have created a composite type to represent this currency value in the database.
But when I try to compile this, I get this compile error (Scala 3):
Ok, then I say to myself, I haven't defined the proper typeclass, and I don't know how. Is there a macro that does this? I tried to compose the implicit instance of TokenConverter but I don't know how. Could you help me solve this issue? And I can make a PR adding this example into https://github.com/tminglei/slick-pg/blob/master/src/test/scala/com/github/tminglei/slickpg/PgCompositeSupportSuite.scala
Also I would add that on the README this link is broken
I would appreciate your help.
The text was updated successfully, but these errors were encountered: