Std.Db.Decode
Std.Db.Decode — typed DB row decoders (Layer 3 Sky source).
Values
andMap : Decoder a -> Decoder (a -> b) -> Decoder b
`andMap fieldDec ctorDec` — applicative-style combine. The
andThen : (a -> Decoder b) -> Decoder a -> Decoder b
`andThen fn dec` — sequence a follow-up decoder that depends on
bool : String -> Decoder Bool
`bool col` — decode column `col` as a Bool.
fail : String -> Decoder a
A decoder that always fails with the given message.
float : String -> Decoder Float
`float col` — decode column `col` as a Float.
int : String -> Decoder Int
`int col` — decode column `col` as an Int.
map : (a -> b) -> Decoder a -> Decoder b
`map fn dec` — transform the decoded value.
map2 : (a -> b -> c) -> Decoder a -> Decoder b -> Decoder c
`map2 fn dA dB` — combine two decoders with a 2-arg function.
map3 : (a -> b -> c -> d) -> Decoder a -> Decoder b -> Decoder c -> Decoder d
Combine three column decoders with a 3-arg constructor.
map4 : (a -> b -> c -> d -> e) -> Decoder a -> Decoder b -> Decoder c -> Decoder d -> Decoder e
Combine four column decoders with a 4-arg constructor.
map5 : (a -> b -> c -> d -> e -> f) -> Decoder a -> Decoder b -> Decoder c -> Decoder d -> Decoder e -> Decoder f
Combine five column decoders with a 5-arg constructor.
money : String -> Decoder Money
`money col` — decode column `col` as a Money. Reads a TEXT
nullable : Decoder a -> Decoder (Maybe a)
`nullable inner` — wrap `inner` so it returns `Nothing` when ANY
optional : String -> Decoder a -> a -> Decoder (a -> b) -> Decoder b
`optional col fieldDec fallback ctorDec` — decode a column,
required : String -> Decoder a -> Decoder (a -> b) -> Decoder b
`required col fieldDec ctorDec` — decode a required column.
string : String -> Decoder String
`string col` — decode column `col` as a String.
succeed : a -> Decoder a
A decoder that always succeeds with the given value, ignoring