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) ReadDecimal() (*Decimal, error)
- func (r *Reader) ReadFloat64() (float64, error)
- func (r *Reader) ReadInt() (int, error)
- func (r *Reader) ReadInt64() (int64, error)
- func (r *Reader) ReadMapLength() (int, error)
- func (r *Reader) ReadNil() (err 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 ¶
View Source
const ( Size8 = 0x18 Size16 = 0x19 Size32 = 0x1a Size64 = 0x1b SizeStream = 0x1f )
Type encoding sizes.
View Source
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.
View Source
const ( False = Simple + 0x14 + iota True Nil Undefined Simple8 Float16 Float32 Float64 Break = Simple + SizeStream )
Simple and special types.
View Source
const ( TagDatetime = iota // string TagTimestamp // seconds from epoch TagPosBigInt TagNegBigInt TagDecimal TagBigFloat )
Standard tags.
View Source
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 ¶
View Source
var ErrMissingKey = awserr.New(request.ParamRequiredErrCode, "One of the required keys was not given a value", nil)
View Source
var ErrNaN = awserr.New(request.InvalidParameterErrCode, "cbor: not a number", nil)
View Source
var ErrNegLength = awserr.New(request.ErrCodeSerialization, "cbor: negative length", nil)
View Source
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) ReadDecimal ¶
func (*Reader) ReadFloat64 ¶
func (*Reader) ReadMapLength ¶
func (*Reader) ReadString ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer writes cbor-encoded data.
func (*Writer) WriteArrayHeader ¶
func (*Writer) WriteArrayStreamHeader ¶
func (*Writer) WriteBoolean ¶
func (*Writer) WriteBytes ¶
func (*Writer) WriteDecimal ¶
func (*Writer) WriteFloat ¶
func (*Writer) WriteFloat64 ¶
func (*Writer) WriteInt64 ¶
func (*Writer) WriteMapHeader ¶
func (*Writer) WriteMapStreamHeader ¶
func (*Writer) WriteStreamBreak ¶
func (*Writer) WriteString ¶
Click to show internal directories.
Click to hide internal directories.