discord test stars

About

BSON encoding and decoding in the Mys programming language.

Project: https://github.com/mys-lang/package-bson

API

trait Element:
    An element in a BSON document.

    func double(self) -> f64:

    func string(self) -> string:

    func document(self) -> [(string, Element)]:

    func get(self, name: string) -> Element:

    func array(self) -> [Element]:

    func at(self, index: i64) -> Element:

    func binary(self) -> (u8, bytes):

    func boolean(self) -> bool:

    func int32(self) -> i32:

    func int64(self) -> i64:
class BsonError(Error):
    message: string
class Double(Element):
    A double.

    value: f64

    func double(self) -> f64:
class String(Element):
    A string.

    value: string

    func string(self) -> string:
class Document(Element):
    A document.

    elements: [(string, Element)]

    func __init__(self, elements: [(string, Element)] = []):

    func document(self) -> [(string, Element)]:

    func get(self, name: string) -> Element:
class Array(Element):
    An array.

    doc: Document

    func __init__(self, elements: [Element] = []):

    func append(self, element: Element):

    func array(self) -> [Element]:

    func at(self, index: i64) -> Element:
class Binary(Element):
    A binary blob.

    value: (u8, bytes)

    func binary(self) -> (u8, bytes):
class ObjectId(Element):
    An object id.

    value: bytes

    func object_id(self) -> bytes:
class Boolean(Element):
    A boolean.

    value: bool

    func boolean(self) -> bool:
class Int32(Element):
    An i32.

    value: i32

    func int32(self) -> i32:
class Int64(Element):
    An i64.

    value: i64

    func int64(self) -> i64:
func decode(data: bytes) -> Document:
    Decode given BSON document.
func encode(document: Document) -> bytes:
    Encode given BSON document.