|
| 1 | +// Copyright (C) MongoDB, Inc. 2022-present. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | +// not use this file except in compliance with the License. You may obtain |
| 5 | +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | + |
| 7 | +// Package bsoncore contains functions that can be used to encode and decode BSON |
| 8 | +// elements and values to or from a slice of bytes. These functions are aimed at |
| 9 | +// allowing low level manipulation of BSON and can be used to build a higher |
| 10 | +// level BSON library. |
| 11 | +// |
| 12 | +// The Read* functions within this package return the values of the element and |
| 13 | +// a boolean indicating if the values are valid. A boolean was used instead of |
| 14 | +// an error because any error that would be returned would be the same: not |
| 15 | +// enough bytes. This library attempts to do no validation, it will only return |
| 16 | +// false if there are not enough bytes for an item to be read. For example, the |
| 17 | +// ReadDocument function checks the length, if that length is larger than the |
| 18 | +// number of bytes available, it will return false, if there are enough bytes, it |
| 19 | +// will return those bytes and true. It is the consumers responsibility to |
| 20 | +// validate those bytes. |
| 21 | +// |
| 22 | +// The Append* functions within this package will append the type value to the |
| 23 | +// given dst slice. If the slice has enough capacity, it will not grow the |
| 24 | +// slice. The Append*Element functions within this package operate in the same |
| 25 | +// way, but additionally append the BSON type and the key before the value. |
| 26 | +// |
| 27 | +// Warning: Package bsoncore is unstable and there is no backward compatibility |
| 28 | +// guarantee. It is experimental and subject to change. |
| 29 | +package bsoncore |
0 commit comments