class BSON::Binary

Container for binary data

use v6;

unit package BSON;
  class Binary { ... }

Synopsis


use UUID;
use BSON::Binary;

my UUID $uuid .= new(:version(4));
my BSON::Binary $bin .= new(
  :data($uuid.Blob),
  :type(BSON::C-UUID)
);

Methods

new

submethod BUILD ( Buf :$data, Int :$type = BSON::C-GENERIC )

Store binary data in the object. The following codes are available:

  • C-GENERIC. Generic binary data. Used for any non structured data.

  • C-FUNCTION. Encoding of function code.

  • C-UUID. Encoding of UUID.

  • C-MD5. Encoding of MD5.

perl

method perl ( Int $indent = 0 --> Str )

Should be used like any other perl without the $indent set. Otherwise it starts of indented.

encode

method encode ( --> Buf )

Encode the binary data. Mostly called from BSON::Document.

decode

method decode (
    Buf:D $b,
    Int:D $index is copy,
    Int:D $nbr-bytes
    --> BSON::Binary
  )

Decode a Buf to BSON::Binary. Mostly called from BSON::Document.

BSON v0.13.3

BSON encoding/decoding, used in MongoDB drivers

Authors

  • Marcel Timmerman
  • Paweł Pabian

License

Artistic-2.0

Dependencies

OpenSSLUUIDMethod::Also

Test Dependencies

Provides

  • BSON
  • BSON::Binary
  • BSON::Decimal128
  • BSON::Decimal128::Actions
  • BSON::Decimal128::Grammar
  • BSON::Decode
  • BSON::Document
  • BSON::Encode
  • BSON::Javascript
  • BSON::ObjectId
  • BSON::Ordered
  • BSON::Regex

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.