on dev help sign in
small stuff
commit8a34ea1a21cbcc3632614c59d59d8160743f6532 authorEitan Chatav <eitan.chatav@gmail.com> dateTue 15 Aug 2017, 19:14 (9 years ago) parent977a38a
2 files changed+12−11
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+9−8 squeal-postgresql/src/Squeal/PostgreSQL/Statement.hs+3−3
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+9−8
@@ -113,10 +113,19 @@ renderAliased
113113renderAliased render (expression `As` alias) =
114114 render expression <> " AS " <> renderAlias alias
115115
116+class IsTableColumn table column expression where
117+ (!) :: Alias table -> Alias column -> expression
118+ infixl 9 !
119+instance IsTableColumn table column (Alias table, Alias column) where (!) = (,)
120+
116121data NullityType = Null PGType | NotNull PGType
117122
118123data ColumnType = Optional NullityType | Required NullityType
119124
125+data Grouping
126+ = Ungrouped
127+ | Grouped [(Symbol,Symbol)]
128+
120129type family BaseType (ty :: ColumnType) where
121130 BaseType (optionality (nullity pg)) = pg
122131
@@ -153,11 +162,3 @@ type family Rename alias0 alias1 xs where
153162type family Join xs ys where
154163 Join '[] ys = ys
155164 Join (x ': xs) ys = x ': Join xs ys
156−
157−data Grouping
158− = Ungrouped
159− | Grouped [(Symbol,Symbol)]
160−
161−class IsTableColumn table column expression where
162− (!) :: Alias table -> Alias column -> expression
163− infixl 9 !
squeal-postgresql/src/Squeal/PostgreSQL/Statement.hs+3−3
@@ -80,12 +80,12 @@ instance (HasTable table tables columns, HasColumn column columns ty)
8080 table ! column = UnsafeExpression $
8181 renderAlias table <> "." <> renderAlias column
8282
83−def :: Expression params '[] grouping ('Optional (nullity ty))
83+def :: Expression params '[] 'Ungrouped ('Optional (nullity ty))
8484def = UnsafeExpression "DEFAULT"
8585
8686unDef
87− :: Expression params '[] grouping ('Required (nullity ty))
88− -> Expression params '[] grouping ('Optional (nullity ty))
87+ :: Expression params '[] 'Ungrouped ('Required (nullity ty))
88+ -> Expression params '[] 'Ungrouped ('Optional (nullity ty))
8989unDef = UnsafeExpression . renderExpression
9090
9191null :: Expression params tables grouping (optionality ('Null ty))