NotLoaded v0.2.1 NotLoaded View Source

Struct returned by fields when they have not been loaded.

Example

defmodule Book do
   import NotLoaded, only: [lazy_loaded: 1]

  defstruct [
     :title,
      lazy_loaded(:author)
   ]
 end

Link to this section Summary

Functions

Defaults a struct field to NotLoaded

Creates a new NotLoaded struct for a given field name

Link to this section Types

Link to this type field_name() View Source
field_name() :: atom()
Link to this type t() View Source
t() :: %NotLoaded{__field__: field_name()}

Link to this section Functions

Link to this macro lazy_loaded(field_name) View Source (macro)

Defaults a struct field to NotLoaded.

Creates a new NotLoaded struct for a given field name.