joeybright/key-value-store-gen/2.0.0

NOTE: the latest version is 3.0.0

KeyValueStoreGen

Generate an Elm module for saving and loading data to an external key-value data source.

For guidance on how to wire the generated code to work with JavaScript through ports, take a look at the examples in the package Github repo.

Configuration

init : List String -> Store

Create a new store. You can pass this to the generate function to generate code with elm-codegen.

Generating a Store

generate : Store -> Value -> File

Generates an Elm file from a passed Store (which you can create with the init function) and some JSON (as a Json.Decode.Value).

If the passed Json cannot be decoded, the generated code will be for managing arbitrary key value pairs with the store. No decoding or encoding will be generated. While this may still be useful, it's less useful than getting all your serialization for free!

The generated code has its behavior documented. If you'd like to understand how your store is working internally, generate some code and read the comments!