bitlap / scalikejdbc-binders   0.1.0

GitHub

scalikejdbc binders helper

Scala versions: 3.x

scalikejdbc-binders

CI codecov Nexus


postgres

  • Dependency
"org.bitlap" %% "scalikejdbc-binders-postgres" % <version>
  • Inherit ArrayBinders
    • Supported TypeBinder
    • Supported ParameterBinderFactory
  • Inherit JsonBinders
    • Supported TypeBinder
    • Supported ParameterBinderFactory

ParameterBinderFactory array

postgres type scala type supported collections
varchar String List,Set,Seq,Vector
integer Int List,Set,Seq,Vector
decimal BigDecimal List,Set,Seq,Vector
bigint Long List,Set,Seq,Vector

TypeBinder array

postgres type scala type supported collections required implicit mapping function
all all List,Set,Seq,Vector Array[Any] => T[X]

ParameterBinderFactory json

postgres type scala type required implicit mapping function
json T String => T

TypeBinder json

postgres type scala type required implicit mapping function
json T T => String

Manual definition

given ParameterBinderFactory[List[Short]] = DeriveParameterBinder.array[Short, List](ObjectType.Short, _.toArray)

given ParameterBinderFactory[Map[String, String]] = DeriveParameterBinder.json[Map[String, String]](toJson)

given TypeBinder[List[BigDecimal]] = DeriveTypeBinder.array[BigDecimal, List](_.toList.map(s => BigDecimal(s.toString)), Nil)