Skip to main content
Module

x/denodb/deps.ts>Bson.UUID

MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
Go to Latest
class Bson.UUID
import { Bson } from "https://deno.land/x/denodb@v1.0.40/deps.ts";
const { UUID } = Bson;

A class representation of the BSON UUID type.

Constructors

new
UUID(input?: string | Buffer | UUID)

Create an UUID type

Properties

_bsontype: "UUID"
id: Buffer

Methods

equals(otherId: string | Buffer | UUID): boolean

Compares the equality of this UUID with otherID.

inspect(): string

Creates a Binary instance from the current UUID.

toHexString(includeDashes?: boolean): string

Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)

toJSON(): string

Converts the id into its JSON string representation. A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

toString(encoding?: string): string

Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.

Static Properties

cacheHexString: boolean

Static Methods

createFromHexString(hexString: string): UUID

Creates an UUID from a hex string representation of an UUID.

generate(): Buffer

Generates a populated buffer containing a v4 uuid

isValid(input: string | Buffer | UUID): boolean

Checks if a value is a valid bson UUID