Package-level declarations

Types

Link copied to clipboard
interface AttributeDescriptor<A, T, B>

Describes a single item attribute and how it is converted from an object of type T and to a build object of type B.

Link copied to clipboard

A sentinel value for indicating that an ItemConverter should be automatically generated by dynamodb-mapper-schema-generator-plugin. This object cannot be used to convert items directly and will throw exceptions when calling convertLeft or convertRight.

Link copied to clipboard
class DocumentItemConverter(numberValueConverter: ValueConverter<Number> = NumberValueConverters.Auto, stringValueConverter: ValueConverter<String> = StringValueConverter, booleanValueConverter: ValueConverter<Boolean> = BooleanValueConverter, nullValueConverter: ValueConverter<Nothing?> = NullValueConverter, attributeValueListValueConverter: ValueConverter<List<AttributeValue>> = AttributeValueListValueConverter, attributeValueMapValueConverter: ValueConverter<Map<String, AttributeValue>> = AttributeValueMapValueConverter) : DocumentConverterBase, Converter<Document.Map, Item>

Converts between Document and Item. The top-level document must be a Document.Map; nested values use the same element-level conversion as DocumentValueConverter.

Link copied to clipboard
class HeterogeneousItemConverter<T>(val typeMapper: (T) -> String, val typeAttribute: String, val subConverters: Map<String, ItemConverter<T>>) : Converter<T, Item>

An item converter which handles heterogeneous (i.e., incongruent) data types by way of a string discriminator attribute identified by typeAttribute. The given typeMapper function must return a string type name for an object which will be used for the typeAttribute attribute. Finally, the given subConverters map identifies the delegate converters for each type.

Link copied to clipboard
typealias ItemConverter<T> = Converter<T, Item>

Defines the logic for converting between objects and DynamoDB items

Link copied to clipboard
sealed interface ItemSchema<T>

Defines a schema for handling objects of type T, including an ItemConverter for converting between objects and items and a KeySpec for identifying primary keys.

Link copied to clipboard
interface KeyAttrSpec<K>

Defines the specification for a single key attribute, including its name and type

Link copied to clipboard
sealed interface KeySpec<K : KeyType>

Defines the specification for a partition or sort key, including the names and types of its attributes. Key specifications are an important component of item schemas since they describe how to interact with each key attribute and provide vital typing information for features which interact with DynamoDB operations like Query and Scan.

Link copied to clipboard
sealed interface KeyType

A key value for a table or index.

Link copied to clipboard
class SimpleItemConverter<T, B>(builderFactory: () -> B, build: B.() -> T, descriptors: AttributeDescriptor<*, T, B>, unknownValueHandling: UnknownValueHandling<B> = UnknownValueHandling.Ignore) : Converter<T, Item>

An item converter which uses attribute descriptors to convert objects to items and vice versa. This converter distinguishes between the object type used for conversion into an item (treated as immutable) and a mutable builder type used for conversion from an item. Note that these do not have to be different types if the object type is already mutable.

Link copied to clipboard
sealed interface UnknownValueHandling<out B>

Identifies how to handle attributes whose keys aren't in an item schema when converting from an item to an entity type

Functions

Link copied to clipboard
fun <A, T, B> AttributeDescriptor(name: String, getter: (T) -> A, setter: B.(A) -> Unit, converter: ValueConverter<A>): AttributeDescriptor<A, T, B>

Instantiates a new AttributeDescriptor

Link copied to clipboard
fun <T, PK : KeyType> ItemSchema(converter: ItemConverter<T>, partitionKey: KeySpec<PK>, attributes: Attributes = emptyAttributes()): ItemSchema.PartitionKey<T, PK>
fun <T, PK : KeyType, SK : KeyType> ItemSchema(converter: ItemConverter<T>, partitionKey: KeySpec<PK>, sortKey: KeySpec<SK>, attributes: Attributes = emptyAttributes()): ItemSchema.CompositeKey<T, PK, SK>

Create a new item schema with a primary key consisting of a single partition key.

Link copied to clipboard
fun Key(value1: Byte): KeyType.Key1<Byte>
fun Key(value1: Int): KeyType.Key1<Int>
fun Key(value1: Long): KeyType.Key1<Long>
fun Key(value1: Short): KeyType.Key1<Short>
fun Key(value1: String): KeyType.Key1<String>

Instantiates a new KeyType consisting of a single value. Additional values may be added with one of the invoke extension function overloads.

Inherited functions

Link copied to clipboard
operator fun <K1> KeyType.Key1<K1>.invoke(value2: Byte): KeyType.Key2<K1, Byte>
operator fun <K1> KeyType.Key1<K1>.invoke(value2: Int): KeyType.Key2<K1, Int>
operator fun <K1> KeyType.Key1<K1>.invoke(value2: Long): KeyType.Key2<K1, Long>
operator fun <K1> KeyType.Key1<K1>.invoke(value2: Short): KeyType.Key2<K1, Short>
operator fun <K1> KeyType.Key1<K1>.invoke(value2: String): KeyType.Key2<K1, String>

Instantiates a new KeyType that builds from a single attribute value into two values. Additional values may be added with one of the invoke extension function overloads.

operator fun <K1, K2> KeyType.Key2<K1, K2>.invoke(value3: Byte): KeyType.Key3<K1, K2, Byte>
operator fun <K1, K2> KeyType.Key2<K1, K2>.invoke(value3: ByteArray): KeyType.Key3<K1, K2, ByteArray>
operator fun <K1, K2> KeyType.Key2<K1, K2>.invoke(value3: Int): KeyType.Key3<K1, K2, Int>
operator fun <K1, K2> KeyType.Key2<K1, K2>.invoke(value3: Long): KeyType.Key3<K1, K2, Long>
operator fun <K1, K2> KeyType.Key2<K1, K2>.invoke(value3: Short): KeyType.Key3<K1, K2, Short>
operator fun <K1, K2> KeyType.Key2<K1, K2>.invoke(value3: String): KeyType.Key3<K1, K2, String>

Instantiates a new KeyType that builds from two attribute values into three values. Additional values may be added with one of the invoke extension function overloads.

operator fun <K1, K2, K3> KeyType.Key3<K1, K2, K3>.invoke(value4: Byte): KeyType.Key4<K1, K2, K3, Byte>
operator fun <K1, K2, K3> KeyType.Key3<K1, K2, K3>.invoke(value4: ByteArray): KeyType.Key4<K1, K2, K3, ByteArray>
operator fun <K1, K2, K3> KeyType.Key3<K1, K2, K3>.invoke(value4: Int): KeyType.Key4<K1, K2, K3, Int>
operator fun <K1, K2, K3> KeyType.Key3<K1, K2, K3>.invoke(value4: Long): KeyType.Key4<K1, K2, K3, Long>
operator fun <K1, K2, K3> KeyType.Key3<K1, K2, K3>.invoke(value4: Short): KeyType.Key4<K1, K2, K3, Short>
operator fun <K1, K2, K3> KeyType.Key3<K1, K2, K3>.invoke(value4: String): KeyType.Key4<K1, K2, K3, String>

Instantiates a new KeyType that builds from three attribute values into four values

Link copied to clipboard

Instantiates a new KeySpec that builds from a single attribute into two attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from two attributes into three attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from three attributes into four attributes

Link copied to clipboard

Instantiates a new KeySpec that builds from a single attribute into two attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from two attributes into three attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from three attributes into four attributes

Link copied to clipboard

Instantiates a new KeySpec that builds from a single attribute into two attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from two attributes into three attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from three attributes into four attributes

Link copied to clipboard

Instantiates a new KeySpec that builds from a single attribute into two attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from two attributes into three attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from three attributes into four attributes

Link copied to clipboard

Instantiates a new KeySpec that builds from a single attribute into two attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from two attributes into three attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from three attributes into four attributes

Link copied to clipboard

Instantiates a new KeySpec that builds from a single attribute into two attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from two attributes into three attributes. Additional attributes may be added with the extension methods thenInt, thenLong, thenString, etc.

Instantiates a new KeySpec that builds from three attributes into four attributes

Link copied to clipboard
fun <T, PK : KeyType> ItemConverter<T>.withKeySpec(partitionKey: KeySpec<PK>, attributes: Attributes = emptyAttributes()): ItemSchema.PartitionKey<T, PK>

Associate this ItemConverter with a KeySpec for a partition key to form a complete ItemSchema

fun <T, PK : KeyType, SK : KeyType> ItemConverter<T>.withKeySpec(partitionKey: KeySpec<PK>, sortKey: KeySpec<SK>, attributes: Attributes = emptyAttributes()): ItemSchema.CompositeKey<T, PK, SK>

Associate this ItemConverter with KeySpec instances for a composite key to form a complete ItemSchema