Kamirus / purescript-selda

A type-safe, high-level SQL library for PureScript
MIT License
89 stars 3 forks source link

New backend - SQLite3 #25

Closed Kamirus closed 4 years ago

Kamirus commented 4 years ago

Main changes:

Detailed changes:

Breaking:

  • SQL statements (e.g. query, insert) no longer re-exported in module Selda
  • class MonadSelda renamed to MonadSeldaPG, added MonadSeldaSQLite3
  • count and sum_ now return Int - not String (generated cast to Int)
  • functions like showQuery no longer return just a String
  • ShowM - monad for generating query string, parameterized over backends
  • showM now takes a placeholder (e.g. "$" in PG, "?" in SQLite3) and the index for the first parameter (usually it starts with 1)
  • showPG and showSQLite3 - auxiliary showM functions for each backend
  • rename module Selda.PG.ShowQuery -> Selda.Query.ShowQuery

Other:

  • PG insert_ and insert1_ uses now GenericInsert instance - generated query is without RETURNING and for many records to insert just one query is executed
  • new module Selda.Query.Class with backend-agnostic type classes (e.g. GenericQuery, MonadSelda) and their related functions (e.g. hoistSeldaWith)
  • new module Selda.Query.ShowStatement
  • refactored tests (queries test suite - extracted common parts)