@@ -44,18 +44,18 @@ type Schema =
4444setup :: Definition '[] Schema
4545setup =
4646 createTable #users
47− ( serial `As` #id :*
48− (text & notNullable) `As` #name :*
49− (vararray int2 & notNullable) `As` #vec :* Nil )
50− ( primaryKey #id `As` #pk_users :* Nil )
47+ ( serial `as` #id :*
48+ (text & notNullable) `as` #name :*
49+ (vararray int2 & notNullable) `as` #vec )
50+ ( primaryKey #id `as` #pk_users )
5151 >>>
5252 createTable #emails
53− ( serial `As` #id :*
54− (int & notNullable) `As` #user_id :*
55− (text & nullable) `As` #email :* Nil )
56− ( primaryKey #id `As` #pk_emails :*
53+ ( serial `as` #id :*
54+ (int & notNullable) `as` #user_id :*
55+ (text & nullable) `as` #email )
56+ ( primaryKey #id `as` #pk_emails :*
5757 foreignKey #user_id #users #id
58− OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
58+ OnDeleteCascade OnUpdateCascade `as` #fk_user_id )
5959
6060teardown :: Definition Schema '[]
6161teardown = dropTable #emails >>> dropTable #users
@@ -63,14 +63,14 @@ teardown = dropTable #emails >>> dropTable #users
6363insertUser :: Manipulation Schema '[ 'NotNull 'PGtext, 'NotNull ('PGvararray 'PGint2)]
6464 '[ "fromOnly" ::: 'NotNull 'PGint4 ]
6565insertUser = insertRows #users
66− (Default `As` #id :* Set (param @1) `As` #name :* Set (param @2) `As` #vec :* Nil) []
67− OnConflictDoNothing (Returning (#id `As` #fromOnly :* Nil))
66+ (Default `as` #id :* Set (param @1) `as` #name :* Set (param @2) `as` #vec) []
67+ OnConflictDoNothing (Returning (#id `as` #fromOnly))
6868
6969insertEmail :: Manipulation Schema '[ 'NotNull 'PGint4, 'Null 'PGtext] '[]
7070insertEmail = insertRows #emails
71− ( Default `As` #id :*
72− Set (param @1) `As` #user_id :*
73− Set (param @2) `As` #email :* Nil ) []
71+ ( Default `as` #id :*
72+ Set (param @1) `as` #user_id :*
73+ Set (param @2) `as` #email ) []
7474 OnConflictDoNothing (Returning Nil)
7575
7676getUsers :: Query Schema '[]
@@ -78,9 +78,9 @@ getUsers :: Query Schema '[]
7878 , "userEmail" ::: 'Null 'PGtext
7979 , "userVec" ::: 'NotNull ('PGvararray 'PGint2)]
8080getUsers = select
81− (#u ! #name `As` #userName :* #e ! #email `As` #userEmail :* #u ! #vec `As` #userVec :* Nil)
82− ( from (table (#users `As` #u)
83− & innerJoin (table (#emails `As` #e))
81+ (#u ! #name `as` #userName :* #e ! #email `as` #userEmail :* #u ! #vec `as` #userVec)
82+ ( from (table (#users `as` #u)
83+ & innerJoin (table (#emails `as` #e))
8484 (#u ! #id .== #e ! #user_id)) )
8585
8686data User = User { userName :: Text, userEmail :: Maybe Text, userVec :: Vector (Maybe Int16) }