framework/io

Interpreter capabilities supplied by the generated runtime or a test.

Types

pub type Context
pub type Promise(value)

宣言された矢印 1 本。生成器が ★ から写して gen/reads/<service>.gleam に置く。 実行側はここに書かれた名前だけで関係先を引く ── 名前を推測しない。

pub type Relation {
  Relation(
    service: String,
    query: String,
    arrow: String,
    from: String,
    prop: String,
    target: String,
  )
}

Constructors

  • Relation(
      service: String,
      query: String,
      arrow: String,
      from: String,
      prop: String,
      target: String,
    )

    Arguments

    service

    Service module。“article_read”

    query

    生成 SQL の名。“to_muse”(gen/sql/queries/<service>/<query>.sql)

    arrow

    矢印の名。“ArticleToMuse”

    from

    root Entity の module。“article”

    prop

    関係 Property の名。“muse”

    target

    関係先 Entity の module。“muse”

Values

pub fn commit(context: Context, carry: carry) -> Promise(Bool)
pub fn finish(context: Context) -> Promise(Nil)
pub fn reject(
  context: Context,
  stage: fn(Context) -> Promise(value),
) -> Promise(Nil)
pub fn relation_many(
  context: Context,
  relation: Relation,
  keys: List(String),
) -> Promise(List(value))

複数の関係(Multi)。鍵の順で返す。鍵が空なら読まずに空。

pub fn relation_one(
  context: Context,
  relation: Relation,
  key: String,
) -> Promise(value)

必須の関係(Has / Held)。関係先が無いのは FK の破れなので、契約違反として落とす。

pub fn relation_option(
  context: Context,
  relation: Relation,
  key: option.Option(String),
) -> Promise(option.Option(value))

任意の関係(Link / Option(Has) / Option(Held))。鍵が無ければ読まずに None。

pub fn resolve(value: value) -> Promise(value)
pub fn then(
  value: Promise(a),
  next: fn(a) -> Promise(b),
) -> Promise(b)
✨ Search Document