OxL Reference

kw db

Contextual keyword — the effect list after the return type (§6.2)

The list of words: §1.4

Syntax

ebnf
Effect      = "io" | "net" | "db" | "time" | "rand" | Ident ;

Grammar: App. A

Defined in

Examples

oxl
atomic(db) {
  db.insert(order)
  db.update(User, uid) { ordersCount += 1 }
  emit OrderEvents(OrderEvent.Created(order.id))
}

— 11.2 Database transaction

oxl
policy Orders {
  allow get(id)        if caller.isUser(db.find(Order, id)?.userId)
  allow list, recent   if caller.has(role: .Support)
  allow *              if caller.service("billing")
  deny  delete         unless caller.has(role: .Admin) && caller is .User(mfa: true, ..)
}

@public rpc health() -> Ok
@allow(role: .Admin) rpc purge() -> Ok
@internal rpc create(…) -> Order

— 13.4 Authorisation and policies

Related diagnostics

atomic-db-effects, cross-shard-tx, query-not-sql, shard-count-clamped, table-schema, effects, data-rights, missing-policy, unknown-policy-target, comptime-error, not-comptime, fixture-yield

See also