tachybase_todo/docs/reference/context.md
2021-11-17 18:54:32 +08:00

542 B

toc
menu

Context

ctx.db

Definition
interface Context {
  db: Database;
}
Examples
async (ctx, next) {
  const User = ctx.db.getCollection('users');
}

ctx.resourcer

ctx.action 待完善

ctx.i18n

app.i18n 的 cloneInstance。详情见 I18next API

Definition
interface Context {
  i18n: I18next.I18n;
}
Examples
async (ctx, next) {
  await ctx.i18n.changeLanguage('zh-CN');
}

ctx.t()