Class UUID

A class representation of the BSON UUID type.BSON UUID类型的类表示形式。

Hierarchy

Constructors

  • Create a UUID type创建UUID类型

    When the argument to the constructor is omitted a random v4 UUID will be generated.当省略构造函数的参数时,将生成一个随机的v4UUID。

    Parameters

    • Optional input: string | Uint8Array | UUID

      Can be a 32 or 36 character hex string (dashes excluded/included) or a 16 byte binary Buffer.可以是32或36个字符的十六进制字符串(不包括破折号)或16字节的二进制缓冲区。

    Returns UUID

Properties

buffer: Uint8Array
position: number
sub_type: number
BUFFER_SIZE: 256 = 256

Initial buffer default size初始缓冲区默认大小

SUBTYPE_BYTE_ARRAY: 2 = 2

Byte Array BSON type字节数组BSON类型

SUBTYPE_COLUMN: 7 = 7

Column BSON typeBSON列类型

SUBTYPE_DEFAULT: 0 = 0

Default BSON type默认BSON类型

SUBTYPE_ENCRYPTED: 6 = 6

Encrypted BSON type加密BSON类型

SUBTYPE_FUNCTION: 1 = 1

Function BSON type功能BSON类型

SUBTYPE_MD5: 5 = 5

MD5 BSON typeMD5 BSON类型

SUBTYPE_USER_DEFINED: 128 = 128

User BSON type用户BSON类型

SUBTYPE_UUID: 4 = 4

UUID BSON typeUUID BSON类型

SUBTYPE_UUID_OLD: 3 = 3

Deprecated UUID BSON type不推荐的UUID BSON类型

Deprecated

Please use SUBTYPE_UUID

Accessors

  • get _bsontype(): "Binary"
  • Returns "Binary"

  • get id(): Uint8Array
  • The UUID bytesUUID字节

    Returns Uint8Array

Methods

  • Compares the equality of this UUID with otherID.比较此UUID与otherID的相等性。

    Parameters

    • otherId: string | Uint8Array | UUID

      UUID instance to compare against.要与之进行比较的UUID实例。

    Returns boolean

  • Returns string

  • the length of the binary sequence二进制序列的长度

    Returns number

  • Updates this binary with byte_value.使用byte_value更新此二进制文件。

    Parameters

    • byteValue: string | number | Uint8Array | number[]

      a single byte we wish to write.我们希望写入的单个字节。

    Returns void

  • Reads length bytes starting at position.从位置开始读取长度字节。

    Parameters

    • position: number

      read from the given position in the Binary.从二进制文件中的给定位置读取。

    • length: number

      the number of bytes to read.

    Returns BinarySequence

  • Creates a Binary instance from the current UUID.从当前UUID创建一个二进制实例。

    Returns Binary

  • Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)以32或36个字符的十六进制字符串表示形式返回UUID id,不包括破折号(默认为36个字符以破折号分隔)

    Parameters

    • Optional includeDashes: boolean

      should the string exclude dash-separators.字符串是否应排除短划线分隔符。

    Returns string

  • Converts the id into its JSON string representation.将id转换为其JSON字符串表示形式。 A 36 character (dashes included) hex string in the format:一个36个字符(包括短划线)的十六进制字符串,格式为: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

    Returns string

  • Converts the id into a 36 character (dashes included) hex string, unless a encoding is specified.将id转换为36个字符(包括短划线)的十六进制字符串,除非指定了编码。

    Parameters

    • Optional encoding: "base64" | "hex"

    Returns string

  • returns a view of the binary value as a Uint8Array以Uint8Array的形式返回二进制值的视图

    Returns Uint8Array

  • Writes a buffer to the binary.将缓冲区写入二进制文件。

    Parameters

    • sequence: BinarySequence

      a string or buffer to be written to the Binary BSON object.要写入Binary BSON对象的字符串或缓冲区。

    • offset: number

      specify the binary of where to write the content.指定写入内容的二进制位置。

    Returns void

  • Creates an UUID from a base64 string representation of an UUID.从UUID的base64字符串表示创建UUID。

    Parameters

    • base64: string

    Returns UUID

  • Creates an UUID from a hex string representation of an UUID.从UUID的十六进制字符串表示形式创建UUID。

    Parameters

    • hexString: string

      32 or 36 character hex string (dashes excluded/included).32或36个字符的十六进制字符串(不包括破折号)。

    Returns UUID

  • Generates a populated buffer containing a v4 uuid生成包含v4 uuid的已填充缓冲区

    Returns Uint8Array

  • Checks if a value is a valid bson UUID检查值是否为有效的bson UUID

    Parameters

    • input: string | Uint8Array | Binary | UUID

      UUID, string or Buffer to validate.要验证的UUID、字符串或缓冲区。

    Returns boolean

Generated using TypeDoc