[{"name":"Db","comment":" A way of storing your data by `Id`\n\n\n# Db\n\n@docs Db, empty, Row\n\n\n# List\n\n@docs fromList, toList\n\n\n# Insert\n\n@docs insert, insertMany\n\n\n# Get\n\n@docs get, getWithId, getMany\n\n\n# Update\n\n@docs update\n\n\n# Map\n\n@docs map, mapItem\n\n\n# Remove\n\n@docs remove\n\n\n# Filter\n\n@docs filter, filterMissing, allPresent\n\n","unions":[{"name":"Db","comment":" Short for \"Database\", it stores data by unique identifiers\n","args":["item"],"cases":[]}],"aliases":[{"name":"Row","comment":" A single row in the `Db`; an `item` paired with its `Id`\n","args":["item"],"type":"( Id.Id item, item )"}],"values":[{"name":"allPresent","comment":" Verify that all the items are present, and if not, fail with a list of the items that are missing\n\n    allPresent [ (id1, Just user1), (id2, Just user2) ]\n    --> Ok [ (id1, user1), (id2, user2) ]\n\n    allPresent [ (id1, Nothing), (id2, Just user2), (id3, Nothing) ]\n    --> Err [ id1, id3 ]\n\n","type":"List.List ( Id.Id item, Maybe.Maybe item ) -> Result.Result (List.List (Id.Id item)) (List.List (Db.Row item))"},{"name":"empty","comment":" An empty `Db` with no entries\n","type":"Db.Db item"},{"name":"filter","comment":" Filter out items from a `Db`\n","type":"(Db.Row item -> Basics.Bool) -> Db.Db item -> Db.Db item"},{"name":"filterMissing","comment":" Take a `List` of items, presumably ones you just retrieved using `getMany`, and filter out\nthe ones that werent present in the `Db`\n\n    myFriendsList\n        |> Db.getMany people\n        |> Db.filterMissing\n        -->: List (Row Person)\n\n","type":"List.List ( Id.Id item, Maybe.Maybe item ) -> List.List (Db.Row item)"},{"name":"fromList","comment":" Initialize a `Db` from a list of id-value pairs\n","type":"List.List (Db.Row item) -> Db.Db item"},{"name":"get","comment":" Get the item under the provided `Id`\n","type":"Db.Db item -> Id.Id item -> Maybe.Maybe item"},{"name":"getMany","comment":" Get many items from a `Db`. The `(id, Nothing)` case represents the item under that `Id` being absent.\n","type":"Db.Db item -> List.List (Id.Id item) -> List.List ( Id.Id item, Maybe.Maybe item )"},{"name":"getWithId","comment":" Just like `get`, except it comes with the `Id`, for those cases where you dont want the item separated from its `Id`\n","type":"Db.Db item -> Id.Id item -> ( Id.Id item, Maybe.Maybe item )"},{"name":"insert","comment":" Insert an item into the `Db` under the given `Id`\n","type":"Db.Row item -> Db.Db item -> Db.Db item"},{"name":"insertMany","comment":" Insert many items into the `Db` under their given `Id`s\n","type":"List.List (Db.Row item) -> Db.Db item -> Db.Db item"},{"name":"map","comment":" Map a `Db` to a different data type.\n","type":"(a -> b) -> Db.Db a -> Db.Db b"},{"name":"mapItem","comment":" Apply a change to just one item in the `Db`, assuming the item is in the `Db` in the first place. This function is just like `update` except deleting the item is not possible.\n","type":"Id.Id item -> (item -> item) -> Db.Db item -> Db.Db item"},{"name":"remove","comment":" Remove the item at the given `Id`, if it exists\n","type":"Id.Id item -> Db.Db item -> Db.Db item"},{"name":"toList","comment":" Turn your `Db` into a list\n","type":"Db.Db item -> List.List (Db.Row item)"},{"name":"update","comment":" Update an item in a `Db`, using an update function. If the item doesnt exist in the `Db`, it comes into the update as `Nothing`. If a `Nothing` comes out of the update function, the value under that id will be removed.\n","type":"Id.Id item -> (Maybe.Maybe item -> Maybe.Maybe item) -> Db.Db item -> Db.Db item"}],"binops":[]},{"name":"Id","comment":" A simple `Id` type for your types that have ids.\n\n\n# Id\n\n@docs Id, fromString, toString, encode, decoder, generator\n\n","unions":[{"name":"Id","comment":" ","args":["x"],"cases":[]}],"aliases":[],"values":[{"name":"decoder","comment":" Decode an `Id`\n\n    Decode.decodeString (Decode.field \"id\" Id.decoder) \"{\\\"id\\\":\\\"19\\\"}\"\n    -- Ok (Id \"19\") : Result String Id\n\n","type":"Json.Decode.Decoder (Id.Id x)"},{"name":"encode","comment":" Encode an `Id`\n\n    Encode.encode 0 (Id.encode id)\n    -- \"\"hDFL0Cs2EqWJ4jc3kMtOrKdEUTWh\"\" : String\n\n    [ (\"id\", Id.encode id) ]\n        |> Encode.object\n        |> Encode.encode 0\n\n    -- {\\\"id\\\":\\\"hDFL0Cs2EqWJ4jc3kMtOrKdEUTWh\\\"} : String\n\n","type":"Id.Id x -> Json.Encode.Value"},{"name":"fromString","comment":" Make an id from a string\n\n    Id.fromString \"vq93rUv0A4\"\n\n","type":"String.String -> Id.Id x"},{"name":"generator","comment":" A way to generate random `Id`s\n\n    import Id exposing (Id)\n    import Random exposing (Seed)\n\n    user : Seed -> ( User, Seed )\n    user seed =\n        let\n            ( id, nextSeed ) =\n                Random.step Id.generator seed\n        in\n        ( { id = id, email = \"Bob@sci.org\" }\n        , nextSeed\n        )\n\n","type":"Random.Generator (Id.Id x)"},{"name":"toString","comment":" Extract the string from an id.\n","type":"Id.Id x -> String.String"}],"binops":[]},{"name":"Remote.Db","comment":" A way of storing your remote data by `Id`, and being able to representing its loading state\n\n\n# Db\n\n@docs Db, empty, Row\n\n\n# Insert\n\n@docs succeed, succeedMany, loading, loadingMany, fail, failMany, insert\n\n\n# Get\n\n@docs get, getWithId, getMany\n\n\n# Update\n\n@docs update\n\n\n# Map\n\n@docs map, mapError, mapItem\n\n\n# Remove\n\n@docs remove\n\n","unions":[{"name":"Db","comment":" Short for \"Database\", it stores data by unique identifiers. The `error` is for loading errors, such as if an http request fails.\n","args":["error","item"],"cases":[]}],"aliases":[{"name":"Row","comment":" A single row in the `Db`; an `Id`, corresponding to either an `item` or the `error` that happend when attempting to load it.\n","args":["error","item"],"type":"( Remote.Id.Id error item, RemoteData.RemoteData error item )"}],"values":[{"name":"empty","comment":" An empty `Db` with no entries\n","type":"Remote.Db.Db error item"},{"name":"fail","comment":" When data fails to load, set it as `Failure` in the `Db`\n","type":"( Remote.Id.Id error item, error ) -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"failMany","comment":" Fail many `Id`, representing them as failing to load in the `Db`\n","type":"List.List ( Remote.Id.Id error item, error ) -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"get","comment":" Get an item out of a `Db`. Notice how it does not return a `Maybe` like `Dict` do. An `Id` that is not present in the `Db` is returned as `RemoteData.NotAsked`.\n","type":"Remote.Db.Db error item -> Remote.Id.Id error item -> RemoteData.RemoteData error item"},{"name":"getMany","comment":" Get many items from a `Db`. The `(id, RemoteData.NotAsked)` case represents the item under that `Id` being absent.\n","type":"Remote.Db.Db error item -> List.List (Remote.Id.Id error item) -> List.List (Remote.Db.Row error item)"},{"name":"getWithId","comment":" Just like `get`, except it comes with the `Id`, for those cases where you dont want the item separated from its `Id`\n","type":"Remote.Db.Db error item -> Remote.Id.Id error item -> Remote.Db.Row error item"},{"name":"insert","comment":" A general insert function into `Db`. You can insert a `RemoteData error item` into a `Db`\n\n    -- if the id is not in the `Db`\n    Remote.Db.get db id\n    --> RemoteData.NotAsked\n\n    -- but if it is..\n    Remote.Db.get\n        (Remote.Db.insert (id, RemoteData.Failure \"Could not load\") db)\n        id\n    --> RemoteData.Failure \"Could not load\"\n\n","type":"Remote.Db.Row error item -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"loading","comment":" Mark the `Id` as `Loading`. After this function is used on a `Db`, it will return `Loading` for that `Id`\n\n    -- if the id is not in the `Db`\n    Remote.Db.get db id\n    --> RemoteData.NotAsked\n\n    -- but if it is..\n    Remote.Db.get (Remote.Db.loading id db) id\n    --> RemoteData.Loading\n\n","type":"Remote.Id.Id error item -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"loadingMany","comment":" Mark a `List` of `Id` as `Loading` in a `Db`\n","type":"List.List (Remote.Id.Id error item) -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"map","comment":" Map a `Db` to a different data type.\n","type":"(a -> b) -> Remote.Db.Db error a -> Remote.Db.Db error b"},{"name":"mapError","comment":" Map the error type of a `Db` to something else.\n","type":"(a -> b) -> Remote.Db.Db a item -> Remote.Db.Db b item"},{"name":"mapItem","comment":" Apply a change to just one item in the `Db`, assuming the item is in the `Db` in the first place. This function is just like `update` except deleting the item is not possible.\n","type":"Remote.Id.Id error item -> (item -> item) -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"remove","comment":" Simply remove an `Id` from a `Db`, resetting that item to `RemoteData.NotAsked`\n\n    Remote.Db.get (Remote.Db.remove id db) id\n    --> RemoteData.NotAsked\n\n","type":"Remote.Id.Id error item -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"succeed","comment":" Insert an `item` into a `Db`, when it has been successfully loaded\n","type":"( Remote.Id.Id error item, item ) -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"succeedMany","comment":" Insert many `item`s into a `Db`, such as when you loaded many items successfully.\n","type":"List.List ( Remote.Id.Id error item, item ) -> Remote.Db.Db error item -> Remote.Db.Db error item"},{"name":"update","comment":" Update an item in a `Db`, using an update function. If the item doesnt exist in the `Db`, it comes into the update as `RemoteData.NotAsked`. If a `RemoteData.NotAsked` comes out of the update function, the value under that id will be removed.\n","type":"Remote.Id.Id error item -> (RemoteData.RemoteData error item -> RemoteData.RemoteData error item) -> Remote.Db.Db error item -> Remote.Db.Db error item"}],"binops":[]}]