Bucketier README

Documentation Documentation

Bucketier is a simple Dictionary application you can use to store data in a simple Bucket (Key/Value store).

See Bucketier.Bucket for more information.

Installation

Bucketier is available as hex package, the package can be installed by adding bucketier to your list of dependencies in mix.exs and optionally start it with your application:

def application do
  [
    applications: [:bucketier],     ### add :bucketier here
    extra_applications: [:logger],
    mod: {YourElixirApp.Application, []}
  ]
end

def deps do
  [
    {:bucketier, "~> 0.1.0"}
  ]
end

Documentation can be found at https://hexdocs.pm/bucketier.

Examples

The best way to figure out how you can use this library is by having a look at this Test suite.

Put some items in a shopping list and retreive the bucket by name

    alias Bucketier.Bucket
    
    Bucket.bucket("shopping list")
    |> Bucket.put( 1, "Milk")
    |> Bucket.put( 2, "Butter")
    |> Bucket.put( 3, "Bread")
    |> Bucket.commit

    Bucket.bucket("shopping list")
    #=> %Bucketier.Bucket{ 
    #=>  data: %{ 1 => "Milk", 2 => "Butter", 3 => "Bread"}, 
    #=>  name: "shopping list"
    #=> }

Bucket.bucket("bucket name") will return a struct of type %Bucket{}. Bucket.put will add keys to this structure but will not save the new state to the Bucketier until you call Bucket.commit(mybucket).

Put some items in a list and retreive values by keys later

    alias Bucketier.Bucket
    
    Bucket.bucket("shopping list")
    |> Bucket.put( 1, "Milk")
    |> Bucket.put( 2, "Butter")
    |> Bucket.put( 3, "Bread")
    |> Bucket.commit

    Bucket.get("shopping list", 2)
    #=> "Butter"

    Bucket.keys("shopping list")
    #=> [1,2,3]

    Bucket.values("shopping list")
    #=> ["Milk, "Butter", "Bread"]

Roadmap

The project is a sidekick from a project at our company and will hopefully mature over the next weeks.

Obviously, updating and deleting of entries, real persistence (on disc), and other features are missing and will follow.