Skip to content

Commit c6dd87d

Browse files
committed
fixup! refactor: extract definer
1 parent 9beb391 commit c6dd87d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/typed_structor.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ defmodule TypedStructor do
3131
3232
* `:define_struct` - if `false`, the type will be defined, but the struct will not be defined. Defaults to `true`.
3333
34+
### custom definer
35+
36+
defmodule MyStruct do
37+
# you must require the definer module to use its define/1 macro
38+
require MyDefiner
39+
40+
use TypedStructor
41+
42+
typed_structor definer: &MyDefiner.define/1 do
43+
field :name, String.t()
44+
field :age, integer()
45+
end
46+
end
47+
3448
## Examples
3549
3650
defmodule MyStruct do

0 commit comments

Comments
 (0)