Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeAttributeValue(reader *Reader) (*dynamodb.AttributeValue, error)
- func DecodeItemKey(reader *Reader, keydef []dynamodb.AttributeDefinition) (map[string]*dynamodb.AttributeValue, error)
- func DecodeItemNonKeyAttributes(ctx aws.Context, reader *Reader, attrListIdToNames *lru.Lru) (map[string]*dynamodb.AttributeValue, error)
- func EncodeAttributeValue(value *dynamodb.AttributeValue, writer *Writer) error
- func EncodeItemKey(item map[string]*dynamodb.AttributeValue, ...) error
- func EncodeItemNonKeyAttributes(ctx aws.Context, item map[string]*dynamodb.AttributeValue, ...) error
- func EncodeLexDecimal(decimal *Decimal, writer BytesWriter) (int, error)
- func GetEncodedItemKey(item map[string]*dynamodb.AttributeValue, ...) ([]byte, error)
- type BytesReader
- type BytesWriter
- type Decimal
- func (d *Decimal) Scale() int
- func (d *Decimal) SetInt(v *big.Int) *Decimal
- func (d *Decimal) SetIntScale(unscaled *big.Int, scale int) *Decimal
- func (d *Decimal) SetScale(scale int) *Decimal
- func (d *Decimal) SetString(s string) (*Decimal, bool)
- func (d *Decimal) String() string
- func (d *Decimal) Unscaled() *big.Int
- type Reader
- func (r *Reader) BytesReader() (*Reader, error)
- func (r *Reader) Close() error
- func (r *Reader) PeekHeader() (hdr byte, err error)
- func (r *Reader) ReadArrayLength() (int, error)
- func (r *Reader) ReadBigInt() (*big.Int, error)
- func (r *Reader) ReadBreak() (err error)
- func (r *Reader) ReadBytes() ([]byte, error)
- func (r *Reader) ReadBytesLength() (int, error)
- func (r *Reader) ReadCborIntegerToString() (string, error)
- func (r *Reader) ReadDecimal() (*Decimal, error)
- func (r *Reader) ReadFloat64() (float64, error)
- func (r *Reader) ReadInt() (int, error)deprecated
- func (r *Reader) ReadInt64() (int64, error)deprecated
- func (r *Reader) ReadMapLength() (int, error)
- func (r *Reader) ReadNil() (err error)
- func (r *Reader) ReadRawBytes(o io.Writer) error
- func (r *Reader) ReadString() (string, error)
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) Flush() error
- func (w *Writer) Write(b []byte) error
- func (w *Writer) WriteArrayHeader(elems int) error
- func (w *Writer) WriteArrayStreamHeader() error
- func (w *Writer) WriteBigInt(value *big.Int) error
- func (w *Writer) WriteBoolean(b bool) error
- func (w *Writer) WriteBytes(b []byte) error
- func (w *Writer) WriteDecimal(value *Decimal) (err error)
- func (w *Writer) WriteFloat(v float32) error
- func (w *Writer) WriteFloat64(v float64) error
- func (w *Writer) WriteInt(value int) error
- func (w *Writer) WriteInt64(value int64) error
- func (w *Writer) WriteMapHeader(pairs int) error
- func (w *Writer) WriteMapStreamHeader() error
- func (w *Writer) WriteNull() error
- func (w *Writer) WriteStreamBreak() error
- func (w *Writer) WriteString(s string) error
- func (w *Writer) WriteTag(tag uint64) error
Constants ¶
const ( Size8 = 0x18 Size16 = 0x19 Size32 = 0x1a Size64 = 0x1b SizeStream = 0x1f )
Type encoding sizes.
const ( PosInt = 0x00 // 0 << 5 PosInt8 = PosInt + Size8 PosInt16 = PosInt + Size16 PosInt32 = PosInt + Size32 PosInt64 = PosInt + Size64 NegInt = 0x20 // 1 << 5 NegInt8 = NegInt + Size8 NegInt16 = NegInt + Size16 NegInt32 = NegInt + Size32 NegInt64 = NegInt + Size64 Bytes = 0x40 // 2 << 5 Bytes8 = Bytes + Size8 Bytes16 = Bytes + Size16 Bytes32 = Bytes + Size32 Bytes64 = Bytes + Size64 BytesStream = Bytes + SizeStream Utf = 0x60 // 3 << 5 Utf8 = Utf + Size8 Utf16 = Utf + Size16 Utf32 = Utf + Size32 Utf64 = Utf + Size64 UtfStream = Utf + SizeStream Array = 0x80 // 4 << 5 Array8 = Array + Size8 Array16 = Array + Size16 Array32 = Array + Size32 Array64 = Array + Size64 ArrayStream = Array + SizeStream Map = 0xa0 // 5 << 5 Map8 = Map + Size8 Map16 = Map + Size16 Map32 = Map + Size32 Map64 = Map + Size64 MapStream = Map + SizeStream Tag = 0xc0 // 6 << 5 Tag8 = Tag + Size8 Tag16 = Tag + Size16 Tag32 = Tag + Size32 Tag64 = Tag + Size64 Simple = 0xe0 // 7 << 5 )
Basic types.
const ( False = Simple + 0x14 + iota True Nil Undefined Simple8 Float16 Float32 Float64 Break = Simple + SizeStream )
Simple and special types.
const ( TagDatetime = iota // string TagTimestamp // seconds from epoch TagPosBigInt TagNegBigInt TagDecimal TagBigFloat )
Standard tags.
const ( MajorTypeMask = 0xe0 // Upper 3 bits of type header defines the major type. MinorTypeMask = 0x1f // Lower 5 bits of type header defines the minor type. )
Variables ¶
var ErrMissingKey = awserr.New(request.ParamRequiredErrCode, "One of the required keys was not given a value", nil)
var ErrNaN = awserr.New(request.InvalidParameterErrCode, "cbor: not a number", nil)
var ErrNegLength = awserr.New(request.ErrCodeSerialization, "cbor: negative length", nil)
var ErrObjTooBig = awserr.New(request.ErrCodeSerialization, "cbor: object too big", nil)
Functions ¶
func DecodeAttributeValue ¶
func DecodeAttributeValue(reader *Reader) (*dynamodb.AttributeValue, error)
func DecodeItemKey ¶
func DecodeItemKey(reader *Reader, keydef []dynamodb.AttributeDefinition) (map[string]*dynamodb.AttributeValue, error)
func EncodeAttributeValue ¶
func EncodeAttributeValue(value *dynamodb.AttributeValue, writer *Writer) error
func EncodeItemKey ¶
func EncodeItemKey(item map[string]*dynamodb.AttributeValue, keydef []dynamodb.AttributeDefinition, writer *Writer) error
func EncodeLexDecimal ¶
func EncodeLexDecimal(decimal *Decimal, writer BytesWriter) (int, error)
func GetEncodedItemKey ¶ added in v1.1.0
func GetEncodedItemKey(item map[string]*dynamodb.AttributeValue, keydef []dynamodb.AttributeDefinition) ([]byte, error)
Types ¶
type BytesReader ¶
type BytesReader interface { io.Reader io.ByteReader }
type BytesWriter ¶
type BytesWriter interface { io.Writer io.ByteWriter }
type Decimal ¶
type Decimal struct {
// contains filtered or unexported fields
}
Decimal represents an arbitrary-precision signed decimal number. It consists of an arbitrary precision integer unscaled value and a scale. If zero or positive, the scale is the number of digits to the right of the decimal point. If negative, the unscaled value of the number is multiplied by ten to the power of the negation of the scale: unscaled * (10 ** -scale).
func DecodeLexDecimal ¶
func DecodeLexDecimal(reader BytesReader) (*Decimal, error)
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) BytesReader ¶
func (*Reader) PeekHeader ¶
func (*Reader) ReadArrayLength ¶
func (*Reader) ReadBytesLength ¶ added in v1.1.0
func (*Reader) ReadCborIntegerToString ¶ added in v1.2.6
Read a CBOR integer (positive or negative) into a decimal string. Use primitive types unless the magnitude of the value requires a big.Int.
func (*Reader) ReadDecimal ¶
func (*Reader) ReadFloat64 ¶
func (*Reader) ReadInt64
deprecated
Deprecated: This method is not safe for reading values that use the high-order bit, because an int64 only has 63 bits for the value's magnitude, but CBOR negative and positive integers have 64 bits (the sign is in the major type). It is left here because it is used to read many values that are safely within the range of an int64, like ports, attribute ids, and parameter counts. However, it is not safe for reading DynamoDB item attribute values. For that use ReadCborIntegerToString().
func (*Reader) ReadMapLength ¶
func (*Reader) ReadString ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer writes cbor-encoded data.