A simple Elixir Dictionary Application
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
config
lib
test
.formatter.exs
.gitignore
CHANGELOG.md
LICENSE.md
README.md
mix.exs
mix.lock

README.md

Bucketier README

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

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.