Class: DynamoDBDatatype

DynamoDBDatatype

Creates a DynamoDBDatatype that takes care of all datatype handling.

new DynamoDBDatatype()

Source:

Methods

binToStr(value) → {string}

Utility to convert a Binary object into a decoded String.
Parameters:
Name Type Description
value object Binary value (Buffer | Uint8Array) depending on Node or browser.
Source:
Throws:
BinConversionError
Returns:
decoded String in UTF-8
Type
string

createSet(set, type) → {Set}

Utility to create the DynamoDB Set Datatype.
Parameters:
Name Type Description
set array An array that contains elements of the same typed as defined by {type}.
type string Can only be a [S]tring, [N]umber, or [B]inary type.
Source:
Throws:
InvalidSetType, InconsistentType
Returns:
Custom Set object that follow {type}.
Type
Set

formatDataType(dataType) → {object}

Formats Javascript datatypes into DynamoDB wire format.
Parameters:
Name Type Description
dataType Javascript datatype (i.e. string, number. For full information, check out the README).
Source:
Throws:
GeneralDatatypeError
Returns:
DynamoDB JSON-like wire format.
Type
object

formatWireType(key, value)

Formats DynamoDB wire format into javascript datatypes.
Parameters:
Name Type Description
key string Key that represents the type of the attribute value
value Javascript datatype of the attribute value produced by DynamoDB
Source:
Throws:
GeneralDatatypeError

strToBin(value) → {object}

Utility to convert a String to a Binary object.
Parameters:
Name Type Description
value string String value to converted to Binary object.
Source:
Throws:
StrConversionError
Returns:
(Buffer | Uint8Array) depending on Node or browser.
Type
object