本文整理汇总了TypeScript中prisma-datamodel.plural函数的典型用法代码示例。如果您正苦于以下问题:TypeScript plural函数的具体用法?TypeScript plural怎么用?TypeScript plural使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plural函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: plural
const relationFields = relations.map(relation => {
const ambiguousRelations = tc.relations.filter(innerRelation => innerRelation.source_table === relation.source_table && innerRelation.target_table === relation.target_table)
const fieldName = ambiguousRelations.length > 1
? plural(relation.source_table) + '_' + plural(
this.removeIdSuffix(relation.source_column)
)
: plural(relation.source_table)
const selfAmbiguousRelations = ambiguousRelations.filter(relation => relation.source_table === relation.target_table)
const isAmbigous = ambiguousRelations.length > 1 || selfAmbiguousRelations.length > 0
return {
name: fieldName,
type: capitalize(relation.source_table),
isRequired: true,
isReadOnly: false,
isId: false,
isList: true,
isUnique: false,
defaultValue: null,
relatedField: null, // TODO
relationName: isAmbigous ? camelCase(fieldName) : null
} as IGQLField
})
开发者ID:dhruvcodeword,项目名称:prisma,代码行数:25,代码来源:postgresIntrospectionResult.ts
示例2: generateManyQueryField
private generateManyQueryField(model: IGQLType) {
const fields = {} as GraphQLFieldConfigMap<any, any>
fields[camelCase(plural(model.name))] = {
type: new GraphQLNonNull(new GraphQLList(this.generators.model.generate(model, {}))),
args: this.generators.manyQueryArguments.generate(model, {})
}
fields[`${camelCase(plural(model.name))}Connection`] = {
type: new GraphQLNonNull(this.generators.modelConnection.generate(model, {})),
args: this.generators.manyQueryArguments.generate(model, {})
}
return fields
}
开发者ID:dhruvcodeword,项目名称:prisma,代码行数:14,代码来源:queryGenerator.ts
示例3: generateDeleteManyField
private generateDeleteManyField(model: IGQLType) {
const fields = {} as GraphQLFieldConfigMap<null, null>
if (this.generators.modelWhereInput.wouldBeEmpty(model, {})) {
return fields
}
fields[`deleteMany${plural(model.name)}`] = {
type: new GraphQLNonNull(this.generators.batchPayload.generate(null, {})),
args: {
where: { type: this.generators.modelWhereInput.generate(model, {}) },
},
}
return fields
}
开发者ID:dhruvcodeword,项目名称:prisma,代码行数:16,代码来源:mutationGenerator.ts
注:本文中的prisma-datamodel.plural函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论