OxL Справочник OxL
РусскийEnglish

fn emitInCondOf

emitInOf for a topic whose policy has conditions (bits as for publishCondOf); the policy is checked before the element goes to the outbox.

Example:

oxl✓ проверяется в CI
use std.orm { Db }

@table("orders")
data Order {
  @pk id: i64
  userId: str
}

data Placed {
  userId: str
  amount: i64
}

topic Events: Placed sharded by .userId

policy Events {
  allow publish if element.amount <= 100
}

cluster demo {
  role store { journal }
}

fn place(db: Db, o: Order) db {
  atomic(db) {
    db.insert(o)
    emit Events(Placed{ userId: o.userId, amount: 5 })
  }
}
pub(api) fn emitInCondOf<T: Serializable>(dbh: i64, h: i64, x: &T, key: bytes, bits: i64) db

С версии. 1.0.0-beta

Параметры

ИмяТип
dbhi64
hi64
x&T
keybytes
bitsi64

Ошибки

panics when the element cannot be written to the outbox or the policy refuses it.

Эффекты

db

Определено в: std/topic/topic.oxl:410

См. также