> For the complete documentation index, see [llms.txt](https://aerocode.gitbook.io/tynamo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aerocode.gitbook.io/tynamo/define-entity/define-property.md).

# Define property

### Define property

Write the `@DynamoProperty` decorator on top of the property definition. This property will be added to DynamoItem. And `@DynamoEntity` is can convert to `AttributeMap`. &#x20;

```typescript
@DynamoEntity(...)
class Cat {
    @DynamoProperty({ keyType: KeyType.hash })
    id!: number;

    @DynamoProperty({ keyType: KeyType.sort })
    age!: number;

    @DynamoProperty({ keyType: KeyType.attr })
    name!: string;

    constructor(id: number, age: number, name: string) {
        this.id = id;
        this.age = age;
        this.name = name;
    }
}
```

For example,

```typescript
const badCat: Cat = new Cat(0, 1, "garfield");
const dynamo: AttributeMap = Mapper.formation(badCat, Cat);
```

It will formationed as,

```typescript
{
    "id": {
        "N": "0"
    },
    "age": {
        "N": "1"
    },
    "name": {
        "S": "garfield"
    }
}
```

### Key Type

```typescript
// Property Type of DynamoDB.
// Specially, HASH and RANGE are KeyType.
export enum KeyType {
    hash = "HASH",
    sort = "RANGE",
    attr = "ATTR"
}
```
