IzumiSy/elm-firestore/7.0.0

NOTE: the latest version is 13.0.0

Firestore.Decode

Decoders for Firestore

type Decoder a

A decoder consisted of Firestore specific decoders.

Json.Decode.Decoder can be generate from this through decode function.

decode : Decoder a -> Decoder a

Generates Json.Decode.Decoder

Constructors

document : a -> Decoder a

Creates a new decoder

This function works like Json.Decode.Pipeline.

Firestore.Decode.document Document
    |> Firestore.Decode.required "name" Firestore.Decode.string
    |> Firestore.Decode.required "age" Firestore.Decode.int
    |> Firestore.Decode.optional "canCode" Firestore.Decode.bool False
required : String -> Field a -> Decoder (a -> b) -> Decoder b

Decodes a required field.

This function is internally delegated into json.Decode.Pipeline.required.

optional : String -> Field a -> a -> Decoder (a -> b) -> Decoder b

Decodes an optional field.

This function is internally delegated into Json.Decode.Pipeline.optional.

Types

type Field a

An identifier type for Firestore encoder

bool : Field Bool
bytes : Field String
int : Field Int
string : Field String
list : Field a -> Field (List a)
dict : Field a -> Field (Dict String a)
maybe : Field a -> Field (Maybe a)