不要怂,就是干,撸起袖子干!

Commit aefb8638 by Simon Schick Committed by Erik Seliger

docs(model): clarify documentation on projection aliasing (#10595)

Closes #10592
1 parent e07a7bea
Showing with 11 additions and 5 deletions
......@@ -25,7 +25,7 @@ Project.findOne({
attributes: ['id', ['name', 'title']]
}).then(project => {
// project will be the first entry of the Projects table with the title 'aProject' || null
// project.title will contain the name of the project
// project.get('title') will contain the name of the project
})
```
......
......@@ -379,15 +379,21 @@ export type OrderItem =
| [typeof Model, typeof Model, string, string];
export type Order = string | Fn | Col | Literal | OrderItem[];
/**
* Please note if this is used the aliased property will not be available on the model instance
* as a property but only via `instance.get('alias')`.
*/
export type ProjectionAlias = [string | Literal | Fn, string];
export type FindAttributeOptions =
| (string | [string | Literal | Fn, string])[]
| (string | ProjectionAlias)[]
| {
exclude: string[];
include?: (string | [string | Literal | Fn, string])[];
include?: (string | ProjectionAlias)[];
}
| {
exclude?: string[];
include: (string | [string | Literal | Fn, string])[];
include: (string | ProjectionAlias)[];
};
/**
......@@ -2211,7 +2217,7 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
public static belongsTo<M extends Model, T extends Model>(
this: ModelCtor<M>, target: ModelCtor<T>, options?: BelongsToOptions
): BelongsTo<M, T>;
/**
* Create an association that is either 1:m or n:m.
*
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!