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

commonMain.aws.sdk.kotlin.hll.dynamodbmapper.expressions.ScalarFuncExpr.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.expressions

import aws.sdk.kotlin.hll.dynamodbmapper.expressions.internal.ScalarFuncExprImpl
import aws.smithy.kotlin.runtime.ExperimentalApi

/**
 * Represents a function expression that yields a non-boolean result as described in
 * [DynamoDB's **function** documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions)
 */
@ExperimentalApi
public interface ScalarFuncExpr : BooleanExpr {
    /**
     * The specific non-boolean function to use
     */
    public val func: ScalarFunc

    /**
     * The attribute path to pass as the function's first argument
     */
    public val path: AttributePath

    /**
     * Any additional arguments used by the function
     */
    public val additionalOperands: List

    override fun  accept(visitor: ExpressionVisitor): T = visitor.visit(this)
}

/**
 * Creates a new non-boolean function expression
 * @param func The specific non-boolean function to use
 * @param path The attribute path to pass as the function's first argument
 * @param additionalOperands Any additional arguments used by the function
 */
@ExperimentalApi
public fun ScalarFuncExpr(
    func: ScalarFunc,
    path: AttributePath,
    additionalOperands: List = listOf(),
): ScalarFuncExpr = ScalarFuncExprImpl(func, path, additionalOperands)

/**
 * Creates a new non-boolean function expression
 * @param func The specific non-boolean function to use
 * @param path The attribute path to pass as the function's first argument
 * @param additionalOperands Any additional arguments used by the function
 */
@ExperimentalApi
public fun ScalarFuncExpr(
    func: ScalarFunc,
    path: AttributePath,
    vararg additionalOperands: Expression,
): ScalarFuncExpr = ScalarFuncExprImpl(func, path, additionalOperands.toList())




© 2015 - 2024 Weber Informatics LLC | Privacy Policy