Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit aefb8638
authored
Mar 22, 2019
by
Simon Schick
Committed by
Erik Seliger
Mar 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(model): clarify documentation on projection aliasing (#10595)
Closes #10592
1 parent
e07a7bea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
docs/models-usage.md
types/lib/model.d.ts
docs/models-usage.md
View file @
aefb863
...
@@ -25,7 +25,7 @@ Project.findOne({
...
@@ -25,7 +25,7 @@ Project.findOne({
attributes
:
[
'id'
,
[
'name'
,
'title'
]]
attributes
:
[
'id'
,
[
'name'
,
'title'
]]
}).
then
(
project
=>
{
}).
then
(
project
=>
{
// project will be the first entry of the Projects table with the title 'aProject' || null
// 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
})
})
```
```
...
...
types/lib/model.d.ts
View file @
aefb863
...
@@ -379,15 +379,21 @@ export type OrderItem =
...
@@ -379,15 +379,21 @@ export type OrderItem =
|
[
typeof
Model
,
typeof
Model
,
string
,
string
];
|
[
typeof
Model
,
typeof
Model
,
string
,
string
];
export
type
Order
=
string
|
Fn
|
Col
|
Literal
|
OrderItem
[];
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
=
export
type
FindAttributeOptions
=
|
(
string
|
[
string
|
Literal
|
Fn
,
string
]
)[]
|
(
string
|
ProjectionAlias
)[]
|
{
|
{
exclude
:
string
[];
exclude
:
string
[];
include
?:
(
string
|
[
string
|
Literal
|
Fn
,
string
]
)[];
include
?:
(
string
|
ProjectionAlias
)[];
}
}
|
{
|
{
exclude
?:
string
[];
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 {
...
@@ -2211,7 +2217,7 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
public
static
belongsTo
<
M
extends
Model
,
T
extends
Model
>
(
public
static
belongsTo
<
M
extends
Model
,
T
extends
Model
>
(
this
:
ModelCtor
<
M
>
,
target
:
ModelCtor
<
T
>
,
options
?:
BelongsToOptions
this
:
ModelCtor
<
M
>
,
target
:
ModelCtor
<
T
>
,
options
?:
BelongsToOptions
):
BelongsTo
<
M
,
T
>
;
):
BelongsTo
<
M
,
T
>
;
/**
/**
* Create an association that is either 1:m or n:m.
* Create an association that is either 1:m or n:m.
*
*
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment