yacto v2.0.0-pre.14 Yacto.Schema behaviour View Source

Yacto 用のスキーマ

以下のように利用する。

defmodule MyApp.Schema.Item do
  use Yacto.Schema, dbname: :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, dbname: :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