yumemi/gen/reader

★ の読み取り。types.gleam / entity/.gleam / service/.gleam から model を起こす。 ここに現れる名前は全部 ★ から来る ── アプリ固有の綴りは1つも持たない。

Types

pub type Error {
  NoTypesModule
  NoKeyFunction(module: String)
  NoEntityType(module: String)
  Unsupported(where: String, detail: String)
  Vocabulary(where: String, detail: String)
  Internal(where: String, detail: String)
}

Constructors

  • NoTypesModule
  • NoKeyFunction(module: String)
  • NoEntityType(module: String)
  • Unsupported(where: String, detail: String)
  • Vocabulary(where: String, detail: String)
  • Internal(where: String, detail: String)

Values

pub fn arrows(entities: List(model.Entity)) -> List(model.Arrow)

矢印。関係 Property 1つにつき1本。逆向きは作らない(20:681)。

pub fn collections(
  units: List(source.Unit),
) -> Result(List(model.Collection), Error)

Entity でないトップレベル module の pub const collection: String。 entity/ と service/ の下は ER / Service の読み取りが所有するため、 ここでは拾わない。

pub fn entities(
  units: List(source.Unit),
) -> Result(List(model.Entity), Error)
pub fn entry_declarations(
  units: List(source.Unit),
) -> Result(List(model.Entry), Error)

入口は無い古い fixture も reader の他の束を検査できるように、entry.gleam が無ければ 空で返す。entry.gleam がある場合は entries を全て読み、route 束はそこからだけ導く。

pub fn entry_notes(app: model.App) -> List(stop.Note)

入口と Service の結びを検査する。faces の不足は Service ごとに名指しするため、 reader の単一 Result ではなく全件の Note として返す。

pub fn key_name_notes(
  app: model.App,
  keyed: List(#(model.Entity, String, String, Bool)),
) -> List(stop.Note)

第 64 条 生成の key.gleam の名(exit 4、B3 のゲート 2 の P1-5)。src/gen/key.gleam は key が値型 1 つの Entity ごとに <entity>(id) を、key が Uuid のものに new_<entity>() を書き、entity/<entity>・yumemi/er・ (Uuid があれば)yumemi/io・key の値型の gen/types/<型> を import する。関数の名か import の名が重なる形を 名指しする(Entity x と new_x、Entity の module の名 er・io・key の値型の module の名)。B2b で key の値型の 型の名(Key、Uuid があれば Context・Promise)が framework の型と重なる形を足した。keyed は生成の判定 emit/back.keyed_entities の結果(#(Entity, 値型の path, 値型の型名, Uuid か)、B2a のゲート 2 の P1-2)。 key.gleam は server.gleam を宣言した app にしか出さないので、宣言の無い app は見ない(P2-1)

pub fn missing_key_notes(
  units: List(source.Unit),
) -> List(stop.Note)
pub fn read(units: List(source.Unit)) -> Result(model.App, Error)
pub fn record_of(
  units: List(source.Unit),
  path: String,
  name: String,
) -> option.Option(
  #(source.Unit, glance.CustomType, glance.Variant),
)

Args の欄の型 path.name が record か(0.16.0 B15b ── back の decode の語彙 ['record', …] と live の送り JsonWire が この 1 つで決める)。record は、置き場の module が app の unit に在り(gen/types/* の値型と yumemi/* の framework の型は 文字列で読むので外す)、opaque でなく、構成子が 1 つで、欄が 1 つ以上で全部名付きの custom type。型引数は見ない ── 型引数の ある record は back が語彙を導けず hook を促し(exit 4)、live は JSON で送る。

pub fn services(
  units: List(source.Unit),
) -> Result(List(model.Service), Error)
pub fn shape_in(
  module: glance.Module,
  annotation: glance.Type,
) -> model.TypeShape

module の中に書かれた型の注釈 -> TypeShape(import は module のものを引く)。別 module の record の欄の型を読む(0.16.0 B15a)

pub fn value_types(
  units: List(source.Unit),
) -> Result(List(model.ValueType), Error)
✨ Search Document