neo4j-driver-core
Version:
Internals of neo4j-driver
63 lines (62 loc) • 2.7 kB
TypeScript
/**
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Represents a Neo4j UUID value, stored as a Uint8Array of length 16, which can be gotten as a uuid string.
* Created {@link UUID} objects are frozen with `Object.freeze()` in constructor and thus immutable.
*
* @access public
* @exports UUID
* @class A class for writing/reading the Neo4j UUID type as a Uint8Array.
* @param { Uint8Array } typedArray A Uint8Array of length 16 representing the UUID
*/
export default class UUID {
readonly _typedArray: Uint8Array;
constructor(typedArray: Uint8Array);
/**
* Returns the internal Uint8Array, note that modifying this will modify the UUID.
*
* @returns {Uint8Array} a Uint8Array of 16 bytes, representing the UUID.
*/
getTypedArray(): Uint8Array;
/**
* @returns {string} The UUID encoded in base16 in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
*/
toString(): string;
/**
* Parses a string representation of a uuid and creates a {@link UUID} from it.
* Created {@link UUID} objects are frozen with `Object.freeze()` in constructor and thus immutable.
*
* @param {string} uuidString a base-16 encoded uuid string of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or without any dashes
* @returns {UUID}
*/
static fromString(uuidString: string): UUID;
}
/**
* Creates a {@link UUID} from a uuid string or length 16 Uint8Array, allowing it to be sent as a parameter of a Neo4j query.
* Created {@link UUID} objects are frozen with `Object.freeze()` in constructor and thus immutable.
*
* @access public
* @param {Uint8Array | string} rawUUID - a uuid string or length 16 Uint8Array with the values of the UUID.
* @return {UUID} - The Neo4j UUID ready to be used as a query parameter
*/
export declare function uuid(rawUUID: Uint8Array | string): UUID;
/**
* Test if given object is an instance of the {@link UUID} class.
* @param {Object} obj the object to test.
* @return {boolean} `true` if given object is a {@link UUID}, `false` otherwise.
*/
export declare function isUUID(obj: any): obj is UUID;