yacto v1.0.7 Yacto.Schema behaviour View Source

example:

defmodule MyApp.Schema.Item do
  use Yacto.Schema

  @impl Yacto.Schema
  def dbname(), do: :default

  schema @auto_source do
    field :name, :string, meta: [null: false, size: 16, index: true]
  end
end

defmodule MyApp.Schema.Player do
  use Yacto.Schema

  @impl Yacto.Schema
  def dbname(), do: :player

  schema @auto_source do
    field :name, :string, meta: [null: false, size: 16, index: true]
  end
end

Link to this section Summary

Link to this section Functions

Link to this macro field(name, type \\ :string, opts \\ []) View Source (macro)
Link to this macro index(field_or_fields, opts \\ []) View Source (macro)
Link to this macro schema(source, list) View Source (macro)
Link to this macro timestamps(opts \\ []) View Source (macro)

Link to this section Callbacks

Link to this callback dbname() View Source
dbname() :: atom()