on dev help sign in
P pair binary

* remove using clause from `deleteFrom_` * FromRow instance for P pairs

commit0a95a9d01bdf5873f2bc9567956e60aea5d2aeba authorEitan Chatav <eitan@Eitans-MacBook-Pro.local> dateWed 20 Feb 2019, 00:22 (8 years ago) parent0e272da
3 files changed+6−4
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+3 squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+2−3 squeal-postgresql/src/Squeal/PostgreSQL/Migration.hs+1−1
squeal-postgresql/src/Squeal/PostgreSQL/Binary.hs+3
@@ -633,6 +633,9 @@ instance
633633 = fmap fromRecord
634634 . hsequence'
635635 . htrans (Proxy @FromField) fromField
636+instance (FromField (col ::: pgkey) (col ::: key), FromRow pgval val)
637+ => FromRow (col ::: pgkey ': pgval) (P (col ::: key), val) where
638+ fromRow (key :* val) = (,) <$> (unComp . fromField) key <*> fromRow val
636639
637640-- | `Only` is a 1-tuple type, useful for encoding a single parameter with
638641-- `toParams` or decoding a single value with `fromRow`.
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+2−3
@@ -564,11 +564,10 @@ deleteFrom_
564564 , row ~ TableToRow table
565565 , columns ~ TableToColumns table )
566566 => QualifiedAlias sch tab -- ^ table to delete from
567− -> UsingClause commons schemas params from
568− -> Condition 'Ungrouped commons schemas params (tab ::: row ': from)
567+ -> Condition 'Ungrouped commons schemas params '[tab ::: row]
569568 -- ^ condition under which to delete a row
570569 -> Manipulation commons schemas params '[]
571−deleteFrom_ tab uses wh = deleteFrom tab uses wh (Returning_ Nil)
570+deleteFrom_ tab wh = deleteFrom tab NoUsing wh (Returning_ Nil)
572571
573572-- | This has the behaviour of a cartesian product, taking all
574573-- possible combinations between @left@ and @right@ - exactly like a
squeal-postgresql/src/Squeal/PostgreSQL/Migration.hs+1−1
@@ -283,7 +283,7 @@ insertMigration = insertInto_ (#migrations ! #schema_migrations) . Values_ $
283283deleteMigration
284284 :: Has "migrations" schemas MigrationsSchema
285285 => Manipulation '[] schemas '[ 'NotNull 'PGtext ] '[]
286−deleteMigration = deleteFrom_ (#migrations ! #schema_migrations) NoUsing (#name .== param @1)
286+deleteMigration = deleteFrom_ (#migrations ! #schema_migrations) (#name .== param @1)
287287
288288-- | Selects a `Migration` from the `MigrationsTable`, returning
289289-- the time at which it was executed.