All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.hll.dynamodbmapper.values.ItemToValueConverter.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99-beta
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */
package aws.sdk.kotlin.hll.dynamodbmapper.values

import aws.sdk.kotlin.hll.dynamodbmapper.model.Item
import aws.sdk.kotlin.hll.dynamodbmapper.model.toItem
import aws.sdk.kotlin.services.dynamodb.model.AttributeValue
import aws.smithy.kotlin.runtime.ExperimentalApi

/**
 * Converts between [Item] and [AttributeValue].
 * This converter is typically chained following an [ItemConverter] using the [andThenTo] extension function.
 */
@ExperimentalApi
public object ItemToValueConverter : ValueConverter {
    /**
     * Convert from [AttributeValue] to [Item]
     */
    override fun convertFrom(to: AttributeValue): Item = to.asM().toItem()

    /**
     * Convert [from] [Item] to [AttributeValue]
     */
    override fun convertTo(from: Item): AttributeValue = AttributeValue.M(from)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy