on dev help sign in
scrap your nils in the readme
commit9ac694b07a297e395aed52a2523765308da3b73e authorEitan Chatav <eitan.chatav@gmail.com> dateWed 5 Sep 2018, 16:32 (8 years ago) parente41a473
1 file changed+18−17
README.md+18−17
README.md+18−17
@@ -45,7 +45,8 @@ composable and cover a large portion of SQL.
4545* connection pools
4646* transactions
4747* views
48−* composite and enumerated types
48+* array, composite and enumerated types
49+* json operations
4950
5051## installation
5152
@@ -133,16 +134,16 @@ let
133134 setup :: Definition '[] Schema
134135 setup =
135136 createTable #users
136− ( serial `As` #id :*
137− (text & notNullable) `As` #name :* Nil )
138− ( primaryKey #id `As` #pk_users :* Nil ) >>>
137+ ( serial `as` #id :*
138+ (text & notNullable) `as` #name )
139+ ( primaryKey #id `as` #pk_users ) >>>
139140 createTable #emails
140− ( serial `As` #id :*
141− (int & notNullable) `As` #user_id :*
142− (text & nullable) `As` #email :* Nil )
143− ( primaryKey #id `As` #pk_emails :*
141+ ( serial `as` #id :*
142+ (int & notNullable) `as` #user_id :*
143+ (text & nullable) `as` #email )
144+ ( primaryKey #id `as` #pk_emails :*
144145 foreignKey #user_id #users #id
145− OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
146+ OnDeleteCascade OnUpdateCascade `as` #fk_user_id )
146147:}
147148```
148149
@@ -187,17 +188,17 @@ of our inserts.
187188let
188189 insertUser :: Manipulation Schema '[ 'NotNull 'PGtext ] '[ "fromOnly" ::: 'NotNull 'PGint4 ]
189190 insertUser = insertRow #users
190− (Default `As` #id :* Set (param @1) `As` #name :* Nil)
191− OnConflictDoNothing (Returning (#id `As` #fromOnly :* Nil))
191+ (Default `as` #id :* Set (param @1) `as` #name)
192+ OnConflictDoNothing (Returning (#id `as` #fromOnly))
192193:}
193194
194195>>> :{
195196let
196197 insertEmail :: Manipulation Schema '[ 'NotNull 'PGint4, 'Null 'PGtext] '[]
197198 insertEmail = insertRow #emails
198− ( Default `As` #id :*
199− Set (param @1) `As` #user_id :*
200− Set (param @2) `As` #email :* Nil )
199+ ( Default `as` #id :*
200+ Set (param @1) `as` #user_id :*
201+ Set (param @2) `as` #email )
201202 OnConflictDoNothing (Returning Nil)
202203:}
203204
@@ -219,9 +220,9 @@ let
219220 '[ "userName" ::: 'NotNull 'PGtext
220221 , "userEmail" ::: 'Null 'PGtext ]
221222 getUsers = select
222− (#u ! #name `As` #userName :* #e ! #email `As` #userEmail :* Nil)
223− ( from (table (#users `As` #u)
224− & innerJoin (table (#emails `As` #e))
223+ (#u ! #name `as` #userName :* #e ! #email `as` #userEmail)
224+ ( from (table (#users `as` #u)
225+ & innerJoin (table (#emails `as` #e))
225226 (#u ! #id .== #e ! #user_id)) )
226227:}
227228