batch_please v0.5.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)
Functions
Callback to create a new FileBatcher batch
Link to this section Types
batch()
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](https://hexdocs.pm/poison/4.0.1/Poison.html#encode/1).decodeis a function which takes a string-encoded item as input and decodes it, returning eitheror. Defaults to [Poison.decode/1`](https://hexdocs.pm/poison/4.0.1/Poison.html#decode/1).
item()
item() :: any()
item() :: any()
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 Functions
batch_init(opts)
Callback to create a new FileBatcher batch.
opts[:batch_directory] can be used to specify where to put batch files
(default /tmp).
opts[:encode] can be used to manually specify an encoder function.