Skip to content

Instantly share code, notes, and snippets.

View envilogger's full-sized avatar

Anton Kudryavtsev envilogger

View GitHub Profile
@pierangeloc
pierangeloc / doobie_newtype.scala
Last active November 23, 2021 13:25
Doobie instances for NewType
import io.estatico.newtype.ops._
import io.estatico.newtype.macros.newtype
import eu.timepit.refined.api.Refined
import doobie.implicits._
import doobie.postgres.implicits._
import doobie.refined.implicits._
/**
* Derive a Put (so it can be interpolated in doobie sql expressions) for any newtype backed by a type that is
* supported by doobie (e.g. any wrapper of String, UUID, Boolean etc)