Interface Projectable<TAttributes>

interface Projectable<TAttributes> {
    attributes?: FindAttributeOptions<TAttributes>;
}

Type Parameters

  • TAttributes = any

Hierarchy (view full)

Properties

Properties

If an array: a list of the attributes that you want to select. Attributes can also be raw SQL (literal), fn, col, and cast

To rename an attribute, you can pass an array, with two elements:

  • The first is the name of the attribute (or literal, fn, col, cast),
  • and the second is the name to give to that attribute in the returned instance.

If include is used: selects all the attributes of the model, plus some additional ones. Useful for aggregations.

Example

{ attributes: { include: [[literal('COUNT(id)'), 'total']] }

If exclude is used: selects all the attributes of the model, except the one specified in exclude. Useful for security purposes

Example

{ attributes: { exclude: ['password'] } }