Crawly.SimpleStorage (Crawly v0.17.2) View Source

Link to this section Summary

Functions

Deletes all objects from the storage

Deletes a given object

Return value for the given key from the term storage.

Initialize storage to store spiders information

Makes a simple list from the simple storage.

Insert a given object in a term storage

Link to this section Functions

Specs

clear() :: :ok | {:error, term()}

Deletes all objects from the storage

iex(17)> Crawly.SimpleStorage.clear() :ok

Specs

delete(table(), key()) :: :ok | {:error, term()}

Deletes a given object

iex(17)> Crawly.SimpleStorage.delete(:siders, Test1) :ok

Specs

get(table(), key()) :: {:ok, value()} | {:error, :not_found} | {:error, term()}

Return value for the given key from the term storage.

iex(1)> Crawly.SimpleStorage.get(:spiders, Test)

iex(1)> Crawly.SimpleStorage.get(:spiders, T)

Specs

init() :: {:error, any()} | {:ok, any()}

Initialize storage to store spiders information

Specs

list(table()) :: [key()] | {:error, term()}

Makes a simple list from the simple storage.

iex(17)> Crawly.SimpleStorage.list(:spiders) [Test4, Test3, Test2, Test1, Test]

Link to this function

put(table_name, key, value)

View Source

Specs

put(table(), key(), value()) :: :ok | {:error, term()}

Insert a given object in a term storage

iex(1)> Crawly.SimpleStorage.put(:spiders, Test, "12345") :ok