跳到主要内容

buildRules()

function buildRules(
entityRules,
rxdbNamedImports,
siblingNamedImports?
): string[];

Defined in: generators/RepositoryGeneratorBase.ts:35

把规则数据渲染成规则类型字面量,并顺带登记所需的命名导入。

Parameters​

ParameterTypeDescription
entityRulesRuleTypeData[]generateEntityRules 产出的规则数据
rxdbNamedImportsSet<string>从 @aiao/rxdb 引入的规则名集合,渲染时就地补齐
siblingNamedImports?Map<string, Set<string>>同目录实体文件的命名导入集合,关系递归产生的 Partial<XxxKeyValue> 会登记到对端实体名下;不传则跳过登记

Returns​

string[]

规则类型字面量数组,顺序与 entityRules 一致

Example​

const rules = buildRules(generateEntityRules(generator, metadata), rxdbNamedImports);