本文整理汇总了TypeScript中human-readable-ids.hri.random方法的典型用法代码示例。如果您正苦于以下问题:TypeScript hri.random方法的具体用法?TypeScript hri.random怎么用?TypeScript hri.random使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类human-readable-ids.hri
的用法示例。
在下文中一共展示了hri.random方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onDbError
export function onDbError(res: Response, msg: string = "", err: any) {
const id = hri.random();
res.status(500).json({
id,
code: "ERR-002",
message: `${msg}, error code ${id}`
});
console.log("Database error occured", id, err);
}
示例2: createEmptyArtifact
public static createEmptyArtifact(): IExpectedArtifact {
return {
id: UUIDGenerator.generateUuid(),
usePriorArtifact: false,
useDefaultArtifact: false,
matchArtifact: {
id: UUIDGenerator.generateUuid(),
customKind: true,
},
defaultArtifact: {
id: UUIDGenerator.generateUuid(),
customKind: true,
},
displayName: HumanReadableIds.random(),
};
}
示例3: createPipelineTemplate
public static createPipelineTemplate(pipeline: IPipeline, owner: string): IPipelineTemplateV2 {
return {
id: UUIDGenerator.generateUuid(),
metadata: {
description: `A pipeline template derived from pipeline "${pipeline.name}" in application "${
pipeline.application
}"`,
name: HumanReadableIds.random(),
owner,
scopes: ['global'],
},
pipeline: PipelineJSONService.clone(pipeline),
protect: false,
schema: 'v2',
variables: [],
};
}