harakiri v1.2.0 Harakiri.Helpers

Summary

Functions

Gets a Map and puts it into an ActionGroup just the way Harakiri needs it

Convenience to get environment bits. Avoid all that repetitive Application.get_env( :myapp, :blah, :blah) noise

Get first row from the table

Get mtime from the OS for the given path

Get the key to be used as on the ETS table

Insert given data into :harakiri_table. Returns {:ok, key} if inserted, :duplicate if given data existed

Get the row for the given key, if it exists. If given key is :"$end_of_table" it will return nil

Insert the given data on the table. Update if it was lready there

Macros

Spit to output any passed variable, with location information

Functions

digest_data(data)

Gets a Map and puts it into an ActionGroup just the way Harakiri needs it.

The Map should look like:

  %{paths: ["file1","file2"], app: :myapp, action: :reload, lib_path: "path"}
env(key, default \\ nil)

Convenience to get environment bits. Avoid all that repetitive Application.get_env( :myapp, :blah, :blah) noise.

env(app, key, default)
first()

Get first row from the table

get_file_mtime(path)

Get mtime from the OS for the given path

get_key(data)

Get the key to be used as on the ETS table

insert(data, opts \\ [])

Insert given data into :harakiri_table. Returns {:ok, key} if inserted, :duplicate if given data existed.

If option :create_paths is truthy, then it tries to create every path in data[:paths]. It returns {:error, reason} when that failed.

lookup(key)

Get the row for the given key, if it exists. If given key is :"$end_of_table" it will return nil.

upsert(data)

Insert the given data on the table. Update if it was lready there.

Macros

spit(obj \\ "", inspect_opts \\ [])

Spit to output any passed variable, with location information.