* Check if a property has a unique index constraint. * @param label The element label. * @param property The property name. * @returns True if the property has a unique constraint.
(label: string, property: string)
| 81 | * @returns True if the property has a unique constraint. |
| 82 | */ |
| 83 | public isUnique(label: string, property: string): boolean { |
| 84 | const config = this.getIndexConfig(label, property); |
| 85 | if (!config) return false; |
| 86 | // Only hash and btree indexes support unique constraints |
| 87 | if (config.type === "hash" || config.type === "btree") { |
| 88 | return config.unique === true; |
| 89 | } |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Get all unique index configurations for a label. |
no test coverage detected