Sqlite.Decode.Row

Decode SQL values by their column name.

This decoder is primarily used to decode results from a SQLite query.

type Decoder a

A decoder for a row.

column : String -> Decoder a -> (a -> Decoder b) -> Decoder b

Decode a Sqlite.Encode.Value for the given column name.

succeed : a -> Decoder a

Create a decoder that always succeeds with the given value.

Often used as the final step when chaining field decoders:

Sqlite.Decode.Row.column "name" Sqlite.Decode.string <| \name ->
Sqlite.Decode.Row.column "age" Sqlite.Decode.int <| \age ->
    Sqlite.Decode.Row.succeed 
        { name = name
        , age = age 
        }
fail : String -> Decoder a

Force a decoder to fail with the given message.