本文整理汇总了TypeScript中klay-core.modelAssertions.oneOf方法的典型用法代码示例。如果您正苦于以下问题:TypeScript modelAssertions.oneOf方法的具体用法?TypeScript modelAssertions.oneOf怎么用?TypeScript modelAssertions.oneOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类klay-core.modelAssertions
的用法示例。
在下文中一共展示了modelAssertions.oneOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: automanage
public automanage(property: IAutomanagePropertyInput): IDatabaseOptions {
assertions.typeof(property, 'object', 'automanage')
property.property = property.property || []
property.phase = property.phase || ValidationPhase.Parse
property.supplyWith = DatabaseOptions._determineSupplyWith(property.supplyWith)
assertions.typeof(property.property, 'array', 'automanage.propertyPath')
assertions.oneOf(property.event, values(DatabaseEvent), 'automanage.event')
assertions.oneOf(property.phase, values(ValidationPhase), 'automanage.phase')
this.spec.automanage.push(property as IAutomanageProperty)
return this
}
示例2: _determineIndex
private static _determineIndex(property: IIndexPropertyInput, i: number): IIndexProperty {
if (Array.isArray(property)) {
return {property, direction: SortDirection.Ascending}
}
assertions.typeof(property, 'object')
assertions.typeof(property.property, 'array', `index.${i}.property`)
assertions.oneOf(property.direction, values(SortDirection), `index.${i}.property`)
return property
}
示例3: constrain
public constrain(input: IConstraintInput): IDatabaseOptions {
assertions.typeof(input, 'object', 'constrain')
input.properties = input.properties || [[]]
input.meta = input.meta || {}
assertions.typeof(input.properties, 'array', 'constrain.propertyPaths')
assertions.ok(input.properties.length, 'must specify at least 1 property for constrain')
assertions.oneOf(input.type, values(ConstraintType), 'constrain.type')
assertions.typeof(input.meta, 'object')
const constrain = input as IConstraint
constrain.name = DatabaseOptions.computeConstraintName(constrain)
constrain.meta = DatabaseOptions.computeMetaProperties(constrain)
this.spec.constrain.push(constrain)
return this
}