batch_please v0.2.0 BatchPlease.FileBatcher

Link to this section Summary

Types

The state of a single FileBatcher batch

Items can be of any type that is representable with the given encode and decode functions (which, by default, use JSON)

Link to this section Types

Link to this type batch()
batch() :: %{filename: String.t, file: File.io_device, encode: (item -> {:ok, String.t} | {:error, String.t}), decode: (String.t -> {:ok, item} | {:error, String.t})}

The state of a single FileBatcher batch.

filename is a string holding the name of the file containing items from the current batch.

file is a filehandle to the current batch file.

encode is a function which takes an item as input and encodes it into string format. It returns either {:ok, encoded_item} or {:error, message}. Defaults to&Poison.encode/1.decodeis a function which takes a string-encoded item as input and decodes it, returning eitheror. Defaults to&Poison.decode/1`.

Link to this type item()
item() :: any

Items can be of any type that is representable with the given encode and decode functions (which, by default, use JSON).