fn subscribeKeyCondOf
subscribeKeyOf for a topic whose policy has conditions (bits: bit 0 an allow condition holds, bit 1 a deny condition holds). The generated T.subscribeKey(key) calls it.
Example:
data Ev {
userId: str
amount: i64
}
topic Evs: Ev sharded by .userId
policy Evs {
allow subscribe if caller.isUser("reader")
}
cluster demo {
role store { journal }
}
fn watch(uid: str) -> () | TopicError io, db {
for await e in Evs.subscribeKey(uid, from: .Earliest) {
print("{e.amount}")
}
}pub(api) fn subscribeKeyCondOf<T: Serializable, K: Serializable>(h: i64, key: &K, from: TopicStart?, bits: i64) -> stream<T, TopicError> dbС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
h | i64 |
key | &K |
from | TopicStart? |
bits | i64 |
Возвращает
stream<T, TopicError>
Эффекты
db
Определено в: std/topic/topic.oxl:551