posexional v1.0.0 Posexional.File View Source

a Posexional.File is the main struct to manage a positional file

Link to this section Summary

Link to this section Functions

Link to this function

find_row(file, name)

View Source
find_row(%Posexional.File{rows: term(), separator: term()}, atom()) ::
  %Posexional.Row{
    fields: term(),
    name: term(),
    row_guesser: term(),
    separator: term(),
    struct_module: term()
  }
Link to this function

get_counters(file)

View Source
get_counters(%Posexional.File{rows: term(), separator: term()}) :: [
  {atom(), pid()}
]
Link to this function

manage_counters(file)

View Source
manage_counters(%Posexional.File{rows: term(), separator: term()}) ::
  %Posexional.File{rows: term(), separator: term()}

adds a generator for every progressive_number_field in the file.

The fields are grouped by name, so that you can specify many counters for every row

Link to this function

new(rows, separator \\ nil)

View Source
Link to this function

read(file, content)

View Source
read(%Posexional.File{rows: term(), separator: term()}, binary()) :: [
  tuple() | String.t()
]
Link to this function

write(file, values)

View Source
write(%Posexional.File{rows: term(), separator: term()}, Keyword.t()) ::
  binary()

creates a file from values

Examples

iex> Posexional.File.write(
...>   Posexional.File.new([ Posexional.Row.new(:row_test, [ Posexional.Field.Value.new(:test1, 5) ]) ]),
...>   [row_test: [test1: "test"], row_test: [test1: "t"]]
...> )
"test \nt    "

iex> Posexional.File.write(
...>   Posexional.File.new([ Posexional.Row.new(:row_test, [ Posexional.Field.Value.new(:test1, 5) ]) ]),
...>   [row_test: [test1: "test"], ne: [test1: "t"]]
...> )
** (RuntimeError) row ne not found
Link to this function

write_path!(file, values, path)

View Source
write_path!(
  %Posexional.File{rows: term(), separator: term()},
  Keyword.t(),
  binary()
) :: {:ok, binary()} | {:error, any()}