TsAccess

Library to generate getters and setters for modules that are using TypedStruct

Installation

If available in Hex, the package can be installed by adding ts_access to your list of dependencies in mix.exs:

def deps do
[
{:ts_access, "~> 0.1.0"}
]
end

Example

Use TsAccess and setters/getters will be generated for module (use TsAccess need to be after use TypedStruct):

defmodule Example do
use TypedStruct
use TsAccess
typedstruct do
field(:name, :string)
end
end
iex> Example.name(%Example{}, "John Doe")
%Example{name: "John Doe"}
iex> Example.name(%Example{name: "John Doe"})
"John Doe"

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ts_access.

Change Log