# KeyCondition

Factory class for DynamoDB key conditions.

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

## 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');
```

## 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.
