• Stars
    star
    5
  • Rank 2,861,643 (Top 57 %)
  • Language
    Elixir
  • Created over 9 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Level for Elixir implements various helper functions and data types for working with Googles Level data store.

Level for Elixir

Level for Elixir implements various helper functions and data types for working with Googles Level data store.

The project is implemented using Basho's eleveldb level data bindings, but its interface varies a bit. If you are looking for a minimal eLevelDb Elixir wrapper which is more true to eleveldb you should check out ExLevelDb by Jonas Skovsgaard.

Installation

The project is on hex.pm. Add it to your dependencies as you would with any other hex-package.

The eleveldb dependency require you to run mix do deps.get, deps.compile because it is not a hex-package.

Examples

Create a data store with a ton of words.

words = Level.create!("/tmp/words")

Level.get(words, "test")

File.stream!("/usr/share/dict/words")
|> Stream.map(&String.strip/1)
|> Enum.into(words)

Level.get(words, "test")

Let us find the palindromes in the words.

palindromes = Level.stream(words, [keys_only: true])
|> Stream.filter(&(&1 == String.reverse(&1)))
|> Enum.into([])

Now let us try to find the longest word between a and g.

longest_word_in_range = Level.range(words, "a", "f\xff", [keys_only: true])
|> Enum.reduce("", fn(word, acc) -> if String.length(acc) <= String.length(word), do: word, else: acc end)

License

The MIT License (MIT)

Copyright (c) 2015 Martin Gausby

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

tortoise

A MQTT Client written in Elixir
Elixir
309
star
2

gen_mqtt

DEPRECATED (use Tortoise instead): An Elixir behaviour that makes it possible to communicate with a MQTT server
Elixir
62
star
3

wifi

Various utility functions for working with the local Wifi network in Elixir. These functions are mostly useful in scripts that could benefit from knowing the current location of the computer or the Wifi surroundings.
Elixir
34
star
4

workshop

A tool for writing workshops in Elixir
Elixir
24
star
5

bit_field_set

Store and manipulate a set of bit flags, mostly used for syncing the state over the wire between peers in a peer to peer network, such as BitTorrent.
Elixir
19
star
6

bencode

A bencode encoder and decoder written in Elixir
Elixir
18
star
7

translitit-cyrillic-russian-to-latin

A cyrilic russian to latin transliteration function written in JavaScript
JavaScript
15
star
8

HTML5-YASnippet-bundle

An opinionated HTML5 YASnippet bundle. It serves my needs.
Emacs Lisp
15
star
9

torrent

work in progress
Elixir
13
star
10

pursuit

A Fast JavaScript Object Property Matching Language
JavaScript
10
star
11

scaffold

A mix task for creating new projects based on templates fetched from a Git-repo
Elixir
7
star
12

aoc2020

Don't think I will complete the full month, but if I solve any days I will post them here—probably all in Elixir
Elixir
6
star
13

mg-elixir-snippets

Personal Elixir snippets used by me, Martin Gausby. You are free to use them too, or fork them if you want to personalise them.
Emacs Lisp
6
star
14

hazel

wip
Elixir
5
star
15

mqtt_client

Hopefully this will become a working MQTT client
Elixir
5
star
16

ecoule

The Écoule static page engine core
JavaScript
5
star
17

matsou

A helper library for working with Riak data types in Elixir
Elixir
5
star
18

emacs.d

My Emacs setup
Emacs Lisp
5
star
19

rebelle

Start a repl session with one or more modules loaded
JavaScript
5
star
20

morse-code-presentation

An article I can point people to if they ask for slides after my live-coding session/presentation April 29
5
star
21

bon-etat

Bon état - a finite state machine.
JavaScript
5
star
22

graphql_deux

R&D Repo for wrapping graphql-erlang in Elixir
Elixir
4
star
23

example_workshop

An example workshop that show what workshop is all about
Elixir
4
star
24

prise

A utility that finds plugins for NPM based frameworks.
JavaScript
4
star
25

processes_presentation

work in progress
3
star
26

tracker

A WIP BitTorrent Tracker written in Elixir
Elixir
3
star
27

math-problem

A solution to the math problem that preschool children can solve within minutes, programmers within hours (because they have to set up unit tests) (This is a joke)
JavaScript
3
star
28

mg-org-wiki

A wiki system piggybacking on org-mode
Emacs Lisp
2
star
29

pursuit-core

A framework for building Fast JavaScript Object Property Matching Languages
JavaScript
2
star
30

vmq_plugin

(Work in progress) Convenience module for implementing VerneMQ Plugins in Elixir
Elixir
2
star
31

translitit-engine

A transliteration engine written in JavaScript
JavaScript
2
star
32

allowance

wip
Elixir
1
star
33

elixir_101_presentation

This aims to be an overview of the Elixir programming language
1
star
34

carousel

A queue that reinsert elements to the back of the queue as they are taken from it
Elixir
1
star
35

log-with-namespace-and-date-stamp

A simple log function with namespace and date-stamp
JavaScript
1
star
36

translitit-cyrillic-ukrainian-to-latin

A cyrillic ukrainian to latin transliteration module written in JavaScript
JavaScript
1
star
37

nantes

Holy giant wooden elephant, I am going to Nantes!
1
star