Skip to content

tpolecat/doobie-tsql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

compile-time typechecked sql literals for doobie

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages