# KeyCondition

Factory class for DynamoDB key conditions.

Obtainable from: KeyCondition.beginsWith, KeyCondition.between, KeyCondition.eq, KeyCondition.ge, KeyCondition.gt, KeyCondition.le, KeyCondition.lt

- Source: [`aws-appsync/lib/key.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/key.ts#L7)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

TypeScript:

```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:

```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:

```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");
```

C# / .NET:

```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");
```

Golang:

```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 // chainable` — Conjunction between two conditions.

- `beginsWith(keyName: string, arg: string): KeyCondition // chainable` (static) — Condition (k, arg).

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

- `between(keyName: string, arg1: string, arg2: string): KeyCondition // chainable` (static) — Condition k BETWEEN arg1 AND arg2, true if k >= arg1 and k <= arg2.

- `eq(keyName: string, arg: string): KeyCondition // chainable` (static) — Condition k = arg, true if the key attribute k is equal to the Query argument.

- `ge(keyName: string, arg: string): KeyCondition // chainable` (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` (static) — Condition k > arg, true if the key attribute k is greater than the Query argument.

- `le(keyName: string, arg: string): KeyCondition // chainable` (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` (static) — Condition k < arg, true if the key attribute k is less than the Query argument.

- `renderTemplate(): string` — Renders the key condition to a VTL string.
