DBKV (dbkv v0.1.4) View Source

A disk-based key-value store built on top of :dets. Inspired by CubDB's intuitive API.

Link to this section Summary

Functions

Returns all entries from table.

Closes a table. Only processes that have opened a table are allowed to close it. All open tables must be closed before the system is stopped.

Decrement a number field by one.

Deletes the entry in table for a specific key.

Deletes all entries from table.

delete_table(table) deprecated
exist?(table) deprecated

Gets the value for a specific key in table.

Returns whether the given key exists in table.

Increment a number field by one.

Returns information about table.

Returns all keys from table.

Opens a table. An empty :dets table is created if no file exists.

Returns whether table is open.

Puts the given value under key in table.

Puts the given value under key unless the entry key already exists in table.

Returns the size of the collection in table.

Updates the key in table with the given function.

Returns all values from table.

Link to this section Types

Link to this section Functions

Specs

all(t()) :: list()

Returns all entries from table.

Specs

close(t()) :: :ok | {:error, any()}

Closes a table. Only processes that have opened a table are allowed to close it. All open tables must be closed before the system is stopped.

Link to this function

create_table(opts \\ [])

View Source
This function is deprecated. Use `open/1` instead.
Link to this function

decrement(table, key, by)

View Source

Specs

decrement(t(), any(), number()) :: number()

Decrement a number field by one.

Specs

delete(t(), any()) :: :ok | {:error, any()}

Deletes the entry in table for a specific key.

Specs

delete_all(t()) :: :ok | {:error, any()}

Deletes all entries from table.

Link to this function

delete_by_key_range(table, min_key, max_key, opts \\ [])

View Source

Specs

delete_by_key_range(t(), any(), any(), keyword()) :: integer() | {:error, any()}
Link to this function

delete_by_match_spec(table, match_spec)

View Source

Specs

delete_by_match_spec(t(), list()) :: integer() | {:error, any()}
Link to this function

delete_by_max_key(table, max_key, opts \\ [])

View Source

Specs

delete_by_max_key(t(), any(), keyword()) :: integer() | {:error, any()}
Link to this function

delete_by_max_value(table, max_value, opts \\ [])

View Source

Specs

delete_by_max_value(t(), any(), keyword()) :: integer() | {:error, any()}
Link to this function

delete_by_min_key(table, min_key)

View Source

Specs

delete_by_min_key(t(), any()) :: integer() | {:error, any()}
Link to this function

delete_by_min_value(table, min_value)

View Source

Specs

delete_by_min_value(t(), any()) :: integer() | {:error, any()}
Link to this function

delete_by_value_range(table, min_value, max_value, opts \\ [])

View Source

Specs

delete_by_value_range(t(), any(), any(), keyword()) ::
  integer() | {:error, any()}
This function is deprecated. Use `close/1` instead.
This function is deprecated. Use `info/1` instead.
This function is deprecated. Use `open?/1` instead.
Link to this function

get(table, key, default \\ nil)

View Source

Specs

get(t(), any(), any()) :: any()

Gets the value for a specific key in table.

Specs

has_key?(t(), any()) :: boolean()

Returns whether the given key exists in table.

Link to this function

increment(table, key, by)

View Source

Specs

increment(t(), any(), number()) :: number()

Increment a number field by one.

Specs

info(t()) :: map() | :undefined

Returns information about table.

Specs

keys(t()) :: list()

Returns all keys from table.

Specs

open(keyword()) :: {:ok, t()} | {:error, any()}

Opens a table. An empty :dets table is created if no file exists.

Specs

open?(t()) :: boolean()

Returns whether table is open.

Specs

put(t(), any(), any()) :: :ok | {:error, any()}

Puts the given value under key in table.

Link to this function

put_new(table, key, value)

View Source

Specs

put_new(t(), any(), any()) :: :ok | {:error, any()}

Puts the given value under key unless the entry key already exists in table.

Link to this function

select_by_key_range(table, min_key, max_key, opts \\ [])

View Source

Specs

select_by_key_range(t(), any(), any(), keyword()) :: list()
Link to this function

select_by_match_spec(table, match_spec)

View Source

Specs

select_by_match_spec(t(), list()) :: list()
Link to this function

select_by_max_key(table, max_key, opts \\ [])

View Source

Specs

select_by_max_key(t(), any(), keyword()) :: list()
Link to this function

select_by_max_value(table, max_value, opts \\ [])

View Source

Specs

select_by_max_value(t(), any(), keyword()) :: list()
Link to this function

select_by_min_key(table, min_key)

View Source

Specs

select_by_min_key(t(), any()) :: list()
Link to this function

select_by_min_value(table, min_value)

View Source

Specs

select_by_min_value(t(), any()) :: list()
Link to this function

select_by_value_range(table, min_value, max_value, opts \\ [])

View Source

Specs

select_by_value_range(t(), any(), any(), keyword()) :: list()

Specs

size(t()) :: integer() | :undefined

Returns the size of the collection in table.

Link to this function

update(table, key, default, fun)

View Source

Specs

update(t(), any(), any(), (any() -> any())) :: :ok | {:error, any()}

Updates the key in table with the given function.

If key is present in table then the existing value is passed to fun and its result is used as the updated value of key. If key is not present in table, default is inserted as the value of key. The default value will not be passed through the update function.

Specs

values(t()) :: list()

Returns all values from table.