https://github.com/tpolecat/doobie-tsql
compile-time typechecked sql literals for doobie
https://github.com/tpolecat/doobie-tsql
Last synced: over 1 year ago
JSON representation
compile-time typechecked sql literals for doobie
- Host: GitHub
- URL: https://github.com/tpolecat/doobie-tsql
- Owner: tpolecat
- Created: 2016-06-01T06:23:38.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-06T19:45:56.000Z (almost 8 years ago)
- Last Synced: 2025-03-18T19:37:48.386Z (over 1 year ago)
- Language: Scala
- Size: 570 KB
- Stars: 20
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```scala
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**](EXAMPLE.md) 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
- [x] CI, etc.
- [ ] better handling of credentials
- [x] Updates returning generated keys.
- [x] Bulk updates.
- [x] remove param type and nullity for ParameterMeta
- [x] Stream
- [ ] `in` clauses (hard, ok to punt)
- [ ] generalized Write deriving (generic, unitary, etc.)
- [x] array~collection read via CBF
- [ ] array~collection write via CBF
- [ ] date/time type mappings
- [x] narrowed derivations (ARRAY int4 to Array[Int] for instance)
= [x] clean up `TPrint` impl, get working in normal REPL
- [ ] tut micro-site
- [x] reducer, monadplus