Function PartitionKeyAttribute

  • A decorator for designating the field for the partition key on the dynamo table.

    Type Parameters

    • T extends default

      The entity to which the decorator is applied.

    • K extends PartitionKey

      The type constraint ensuring the field is suitable to be a partition key.

    Parameters

    Returns (_value: undefined, context: ClassFieldDecoratorContext<T, K>) => void

    A class field decorator function that targets and initializes the class's prototype to register the partition key with the ORM's metadata system.

    Usage example:

    class User extends TableClass {
    @PartitionKeyAttribute()
    public pk: PartitionKey;
    }

    In this example, @PartitionKeyAttribute decorates the pk field of User, marking it as the entity's partition key.