pointers v0.2.0 Pointers.Schema View Source

Some macros to help you define schemas.

Link to this section Summary

Functions

Defines a schema that can be pointed to - one keyed by autogenerated ULID that you promise to have run the corresponding migrations for.

Define a trait schema - one that keyed by ULID, is not pointable and does not autogenerate IDs. Takes a trait name (atom) which will be used to autogenerate alias names sigh

Define a table schema with a ULID as a primary key but that is not participating in the pointers abstraction.

Link to this section Functions

Link to this macro

pointable_schema(table, id, autogenerate \\ true, body)

View Source (macro)

Defines a schema that can be pointed to - one keyed by autogenerated ULID that you promise to have run the corresponding migrations for.

Takes a ULID in text form which is a sentinel value used to identify the table. It must match the one inserted into Table in the migrations that create this table.

Link to this macro

trait_schema(table, name, body)

View Source (macro)

Define a trait schema - one that keyed by ULID, is not pointable and does not autogenerate IDs. Takes a trait name (atom) which will be used to autogenerate alias names sigh

Link to this macro

ulid_schema(table, autogenerate \\ true, body)

View Source (macro)

Define a table schema with a ULID as a primary key but that is not participating in the pointers abstraction.