All Projects → tpolecat → doobie-tsql

tpolecat / doobie-tsql

Licence: other
compile-time typechecked sql literals for doobie

Programming Languages

scala
5932 projects

doobie-tsql

Compile-time checked SQL literals for doobie with fancy inferred types.

This is a prototype that works with doobie 0.4.2-SNAPSHOT for Cats on Scala 2.12. There is a snapshot release on Sonatype that you can use thus:

resolvers in ThisBuild +=
  "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

libraryDependencies ++= Seq(
  "org.tpolecat" %% "doobie-tsql-core"          % "0.2-SNAPSHOT",
  "org.tpolecat" %% "doobie-tsql-postgres" % "0.2-SNAPSHOT" // optional, for array type mappings and some other things
)

The high points:

  • The new tsql interpolator checks statements against the live schema at compile-time and infers fancy types that allow fine-grained type mappings that can be constrained based on schema-specific types or even table/column names.
  • The new Read and Write typeclasses subsume the Meta/Atom/Composite stack. The design is more general and much simpler.
  • Some rough edges and basically no doc yet. Sorry.

See the EXAMPLE for much more information.

Building

If you want to build and run the tests you will need to set up MySQL and Postgres as specified in the .travis.yml file. The H2 tests don't require any setup.

TODO

  • CI, etc.
  • better handling of credentials
  • Updates returning generated keys.
  • Bulk updates.
  • remove param type and nullity for ParameterMeta
  • Stream
  • in clauses (hard, ok to punt)
  • generalized Write deriving (generic, unitary, etc.)
  • array~collection read via CBF
  • array~collection write via CBF
  • date/time type mappings
  • narrowed derivations (ARRAY int4 to Array[Int] for instance) = [x] clean up TPrint impl, get working in normal REPL
  • tut micro-site
  • reducer, monadplus
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].