Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- emptyColumns :: Columns '[]
- rowsCount :: Columns columns -> UVarInt
- appendColumn :: KnownColumn (Column name chType) => Column name chType -> Columns columns -> Columns (Column name chType ': columns)
- class HasColumns hasColumns where
- type GetColumns hasColumns :: [Type]
- type family TakeColumn (name :: Symbol) (columns :: [Type]) :: (Type, [Type]) where ...
- type family GoTakeColumn name (columns :: [Type]) (acc :: [Type]) :: (Type, [Type]) where ...
- type family (list1 :: [Type]) ++ (list2 :: [Type]) :: [Type] where ...
- type GenericWritable record columns = (Generic record, GWritable columns (Rep record))
- class (HasColumns (Columns (GetColumns columns)), Serializable (Columns (GetColumns columns)), DeserializableColumns (Columns (GetColumns columns))) => WritableInto columns record where
- serializeRecords :: ProtocolRevision -> UVarInt -> [record] -> Builder
- writingColumns :: Builder
- columnsCount :: UVarInt
- class GWritable (columns :: [Type]) f where
- gSerializeRecords :: ProtocolRevision -> UVarInt -> [f p] -> Builder
- gWritingColumns :: Builder
- gColumnsCount :: UVarInt
- type GenericReadable record hasColumns = (Generic record, GReadable (GetColumns hasColumns) (Rep record))
- class (HasColumns hasColumns, DeserializableColumns (Columns (GetColumns hasColumns))) => ReadableFrom hasColumns record where
- deserializeColumns :: ProtocolRevision -> UVarInt -> Get [record]
- readingColumns :: Builder
- class GReadable (columns :: [Type]) f where
- gFromColumns :: ProtocolRevision -> UVarInt -> Get [f p]
- gReadingColumns :: Builder
Columns
emptyColumns :: Columns '[] Source #
appendColumn :: KnownColumn (Column name chType) => Column name chType -> Columns columns -> Columns (Column name chType ': columns) Source #
Columns extraction helper
class HasColumns hasColumns Source #
type GetColumns hasColumns :: [Type] Source #
Instances
HasColumns (Columns columns) Source # | |
Defined in ClickHaskell.Columns type GetColumns (Columns columns) :: [Type] Source # | |
HasColumns (Table name columns) Source # | |
Defined in ClickHaskell type GetColumns (Table name columns) :: [Type] Source # | |
HasColumns (View name columns parameters) Source # | |
Defined in ClickHaskell type GetColumns (View name columns parameters) :: [Type] Source # |
Take column by name from list of columns
type family TakeColumn (name :: Symbol) (columns :: [Type]) :: (Type, [Type]) where ... Source #
TakeColumn name columns = GoTakeColumn name columns '[] |
type family GoTakeColumn name (columns :: [Type]) (acc :: [Type]) :: (Type, [Type]) where ... Source #
GoTakeColumn name (Column name chType ': columns) acc = '(Column name chType, acc ++ columns) | |
GoTakeColumn name (Column name1 chType ': columns) acc = GoTakeColumn name columns (Column name1 chType ': acc) | |
GoTakeColumn name '[] acc = TypeError ((('Text "There is no column \"" :<>: 'Text name) :<>: 'Text "\" in table") :$$: 'Text "You can't use this field") |
To columns generic convertion
class (HasColumns (Columns (GetColumns columns)), Serializable (Columns (GetColumns columns)), DeserializableColumns (Columns (GetColumns columns))) => WritableInto columns record where Source #
Nothing
serializeRecords :: ProtocolRevision -> UVarInt -> [record] -> Builder Source #
default serializeRecords :: GenericWritable record (GetColumns columns) => ProtocolRevision -> UVarInt -> [record] -> Builder Source #
writingColumns :: Builder Source #
default writingColumns :: GenericWritable record (GetColumns columns) => Builder Source #
columnsCount :: UVarInt Source #
default columnsCount :: GenericWritable record (GetColumns columns) => UVarInt Source #
class GWritable (columns :: [Type]) f where Source #
gSerializeRecords :: ProtocolRevision -> UVarInt -> [f p] -> Builder Source #
Instances
GWritable columns (left1 :*: (left2 :*: right)) => GWritable columns ((left1 :*: left2) :*: right) Source # | |
Defined in ClickHaskell.Columns gSerializeRecords :: ProtocolRevision -> UVarInt -> [((left1 :*: left2) :*: right) p] -> Builder Source # | |
(GWritable '[Column name chType] (S1 ('MetaSel ('Just name) a b f) rec), GWritable restColumns right, '(Column name chType, restColumns) ~ TakeColumn name columns) => GWritable columns (S1 ('MetaSel ('Just name) a b f) rec :*: right) Source # | |
Defined in ClickHaskell.Columns gSerializeRecords :: ProtocolRevision -> UVarInt -> [(S1 ('MetaSel ('Just name) a b f) rec :*: right) p] -> Builder Source # | |
GWritable columns f => GWritable columns (D1 c (C1 c2 f)) Source # | |
Defined in ClickHaskell.Columns gSerializeRecords :: ProtocolRevision -> UVarInt -> [D1 c (C1 c2 f) p] -> Builder Source # | |
(KnownColumn (Column name chType), ToChType chType inputType, Serializable (Column name chType), '(Column name chType, restColumns) ~ TakeColumn name columns) => GWritable columns (S1 ('MetaSel ('Just name) a b f) (Rec0 inputType)) Source # | |
Defined in ClickHaskell.Columns gSerializeRecords :: ProtocolRevision -> UVarInt -> [S1 ('MetaSel ('Just name) a b f) (Rec0 inputType) p] -> Builder Source # |
From columns generic convertion
Reading
type GenericReadable record hasColumns = (Generic record, GReadable (GetColumns hasColumns) (Rep record)) Source #
class (HasColumns hasColumns, DeserializableColumns (Columns (GetColumns hasColumns))) => ReadableFrom hasColumns record where Source #
Nothing
deserializeColumns :: ProtocolRevision -> UVarInt -> Get [record] Source #
default deserializeColumns :: GenericReadable record hasColumns => ProtocolRevision -> UVarInt -> Get [record] Source #
readingColumns :: Builder Source #
default readingColumns :: GenericReadable record hasColumns => Builder Source #
class GReadable (columns :: [Type]) f where Source #
gFromColumns :: ProtocolRevision -> UVarInt -> Get [f p] Source #
Instances
GReadable columns (left :*: (right1 :*: right2)) => GReadable columns ((left :*: right1) :*: right2) Source # | |
Defined in ClickHaskell.Columns gFromColumns :: ProtocolRevision -> UVarInt -> Get [((left :*: right1) :*: right2) p] Source # | |
GReadable columns f => GReadable columns (D1 c (C1 c2 f)) Source # | |
Defined in ClickHaskell.Columns gFromColumns :: ProtocolRevision -> UVarInt -> Get [D1 c (C1 c2 f) p] Source # | |
(KnownColumn (Column name chType), DeserializableColumn (Column name chType), FromChType chType inputType, '(Column name chType, restColumns) ~ TakeColumn name columns) => GReadable columns (S1 ('MetaSel ('Just name) a b f) (Rec0 inputType)) Source # | |
Defined in ClickHaskell.Columns gFromColumns :: ProtocolRevision -> UVarInt -> Get [S1 ('MetaSel ('Just name) a b f) (Rec0 inputType) p] Source # | |
(KnownColumn (Column name chType), GReadable '[Column name chType] (S1 sel rec), GReadable restColumns right) => GReadable (Column name chType ': restColumns) (S1 sel rec :*: right) Source # | |
Defined in ClickHaskell.Columns gFromColumns :: ProtocolRevision -> UVarInt -> Get [(S1 sel rec :*: right) p] Source # |