commonMain.aws.sdk.kotlin.hll.dynamodbmapper.model.internal.IndexImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dynamodb-mapper-jvm Show documentation
Show all versions of dynamodb-mapper-jvm Show documentation
High level DynamoDbMapper client
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.hll.dynamodbmapper.model.internal
import aws.sdk.kotlin.hll.dynamodbmapper.DynamoDbMapper
import aws.sdk.kotlin.hll.dynamodbmapper.items.ItemSchema
import aws.sdk.kotlin.hll.dynamodbmapper.model.Index
import aws.sdk.kotlin.hll.dynamodbmapper.model.IndexSpec
import aws.sdk.kotlin.hll.dynamodbmapper.operations.IndexOperations
import aws.sdk.kotlin.hll.dynamodbmapper.operations.IndexOperationsImpl
internal fun indexImpl(
mapper: DynamoDbMapper,
tableName: String,
indexName: String,
schema: ItemSchema.PartitionKey,
): Index.PartitionKey {
val specImpl = IndexSpecPartitionKeyImpl(mapper, tableName, indexName, schema)
val opsImpl = IndexOperationsImpl(specImpl)
return object :
Index.PartitionKey,
IndexSpec.PartitionKey by specImpl,
IndexOperations by opsImpl { }
}
internal fun indexImpl(
mapper: DynamoDbMapper,
tableName: String,
indexName: String,
schema: ItemSchema.CompositeKey,
): Index.CompositeKey {
val specImpl = IndexSpecCompositeKeyImpl(mapper, tableName, indexName, schema)
val opsImpl = IndexOperationsImpl(specImpl)
return object :
Index.CompositeKey,
IndexSpec.CompositeKey by specImpl,
IndexOperations by opsImpl { }
}