Function SortKeyAttribute

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

    Type Parameters

    • T extends default

      The entity to which the decorator is applied.

    • K extends SortKey

      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 sort key with the ORM's metadata system.

    Usage example:

    class User extends TableClass {
    @SortKeyAttribute()
    public sk: SortKey;
    }

    In this example, @SortKeyAttribute decorates the sk field of User, marking it as the entity's sort key.