Skip to content
v2.277.0

KeyCondition Class ​

Factory class for DynamoDB key conditions.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
const keyCondition = appsync.KeyCondition.beginsWith('keyName', 'arg');
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync

key_condition = appsync.KeyCondition.begins_with("keyName", "arg")
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;

KeyCondition keyCondition = KeyCondition.beginsWith("keyName", "arg");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;

var keyCondition = KeyCondition.BeginsWith("keyName", "arg");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

keyCondition := awscdk.Aws_appsync.KeyCondition_BeginsWith(jsii.String("keyName"), jsii.String("arg"))

Methods ​

and(keyCond: KeyCondition): KeyCondition // chainabledef and(self, key_cond: KeyCondition) -> KeyConditionpublic KeyCondition and(KeyCondition keyCond)public KeyCondition And(KeyCondition keyCond)func And(KeyCond KeyCondition) KeyCondition #
Conjunction between two conditions.
beginsWith(keyName: string, arg: string): KeyCondition // chainable@staticmethod def begins_with(key_name: str, arg: str) -> KeyConditionpublic static KeyCondition beginsWith(String keyName, String arg)public static KeyCondition BeginsWith(string keyName, string arg)func BeginsWith(KeyName *string, Arg *string) KeyCondition static #
Condition (k, arg).

True if the key attribute k begins with the Query argument.

between(keyName: string, arg1: string, arg2: string): KeyCondition // chainable@staticmethod def between(key_name: str, arg1: str, arg2: str) -> KeyConditionpublic static KeyCondition between(String keyName, String arg1, String arg2)public static KeyCondition Between(string keyName, string arg1, string arg2)func Between(KeyName *string, Arg1 *string, Arg2 *string) KeyCondition static #
Condition k BETWEEN arg1 AND arg2, true if k >= arg1 and k <= arg2.
eq(keyName: string, arg: string): KeyCondition // chainable@staticmethod def eq(key_name: str, arg: str) -> KeyConditionpublic static KeyCondition eq(String keyName, String arg)public static KeyCondition Eq(string keyName, string arg)func Eq(KeyName *string, Arg *string) KeyCondition static #
Condition k = arg, true if the key attribute k is equal to the Query argument.
ge(keyName: string, arg: string): KeyCondition // chainable@staticmethod def ge(key_name: str, arg: str) -> KeyConditionpublic static KeyCondition ge(String keyName, String arg)public static KeyCondition Ge(string keyName, string arg)func Ge(KeyName *string, Arg *string) KeyCondition static #
Condition k >= arg, true if the key attribute k is greater or equal to the Query argument.
gt(keyName: string, arg: string): KeyCondition // chainable@staticmethod def gt(key_name: str, arg: str) -> KeyConditionpublic static KeyCondition gt(String keyName, String arg)public static KeyCondition Gt(string keyName, string arg)func Gt(KeyName *string, Arg *string) KeyCondition static #
Condition k > arg, true if the key attribute k is greater than the Query argument.
le(keyName: string, arg: string): KeyCondition // chainable@staticmethod def le(key_name: str, arg: str) -> KeyConditionpublic static KeyCondition le(String keyName, String arg)public static KeyCondition Le(string keyName, string arg)func Le(KeyName *string, Arg *string) KeyCondition static #
Condition k <= arg, true if the key attribute k is less than or equal to the Query argument.
lt(keyName: string, arg: string): KeyCondition // chainable@staticmethod def lt(key_name: str, arg: str) -> KeyConditionpublic static KeyCondition lt(String keyName, String arg)public static KeyCondition Lt(string keyName, string arg)func Lt(KeyName *string, Arg *string) KeyCondition static #
Condition k < arg, true if the key attribute k is less than the Query argument.
renderTemplate(): stringdef render_template(self, ) -> strpublic String renderTemplate()public string RenderTemplate()func RenderTemplate() *string #
Renders the key condition to a VTL string.