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 99f396c5
authored
Apr 22, 2019
by
Simon Schick
Committed by
Sushant
Apr 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): add index hints (#10815)
1 parent
030e0fac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
types/index.d.ts
types/lib/index-hints.d.ts
types/lib/model.d.ts
types/test/index-hints.ts
types/index.d.ts
View file @
99f396c
...
@@ -3,6 +3,7 @@ import Deferrable = require('./lib/deferrable');
...
@@ -3,6 +3,7 @@ import Deferrable = require('./lib/deferrable');
import
Op
=
require
(
'./lib/operators'
);
import
Op
=
require
(
'./lib/operators'
);
import
QueryTypes
=
require
(
'./lib/query-types'
);
import
QueryTypes
=
require
(
'./lib/query-types'
);
import
TableHints
=
require
(
'./lib/table-hints'
);
import
TableHints
=
require
(
'./lib/table-hints'
);
import
IndexHints
=
require
(
'./lib/index-hints'
);
import
Utils
=
require
(
'./lib/utils'
);
import
Utils
=
require
(
'./lib/utils'
);
export
*
from
'./lib/sequelize'
;
export
*
from
'./lib/sequelize'
;
...
@@ -15,5 +16,5 @@ export * from './lib/errors';
...
@@ -15,5 +16,5 @@ export * from './lib/errors';
export
{
BaseError
as
Error
}
from
'./lib/errors'
;
export
{
BaseError
as
Error
}
from
'./lib/errors'
;
export
{
useInflection
}
from
'./lib/utils'
;
export
{
useInflection
}
from
'./lib/utils'
;
export
{
Promise
}
from
'./lib/promise'
;
export
{
Promise
}
from
'./lib/promise'
;
export
{
Utils
,
QueryTypes
,
Op
,
TableHints
,
DataTypes
,
Deferrable
};
export
{
Utils
,
QueryTypes
,
Op
,
TableHints
,
IndexHints
,
DataTypes
,
Deferrable
};
export
{
Validator
as
validator
}
from
'./lib/utils/validator-extras'
;
export
{
Validator
as
validator
}
from
'./lib/utils/validator-extras'
;
types/lib/index-hints.d.ts
0 → 100644
View file @
99f396c
/**
* Available index hints to be used for querying data in mysql for index hints.
*/
declare
enum
IndexHints
{
USE
=
'USE'
,
FORCE
=
'FORCE'
,
IGNORE
=
'IGNORE'
}
export
=
IndexHints
;
types/lib/model.d.ts
View file @
99f396c
...
@@ -20,6 +20,7 @@ import { QueryOptions } from './query-interface';
...
@@ -20,6 +20,7 @@ import { QueryOptions } from './query-interface';
import
{
Config
,
Options
,
Sequelize
,
SyncOptions
}
from
'./sequelize'
;
import
{
Config
,
Options
,
Sequelize
,
SyncOptions
}
from
'./sequelize'
;
import
{
Transaction
}
from
'./transaction'
;
import
{
Transaction
}
from
'./transaction'
;
import
{
Col
,
Fn
,
Literal
,
Where
}
from
'./utils'
;
import
{
Col
,
Fn
,
Literal
,
Where
}
from
'./utils'
;
import
{
IndexHints
}
from
'..'
;
export
interface
Logging
{
export
interface
Logging
{
/**
/**
...
@@ -432,12 +433,24 @@ export type FindAttributeOptions =
...
@@ -432,12 +433,24 @@ export type FindAttributeOptions =
include
:
(
string
|
ProjectionAlias
)[];
include
:
(
string
|
ProjectionAlias
)[];
};
};
export
interface
IndexHint
{
type
:
IndexHints
;
value
:
string
[];
}
export
interface
IndexHintable
{
/**
* MySQL only.
*/
indexHints
?:
IndexHint
[];
}
/**
/**
* Options that are passed to any model creating a SELECT query
* Options that are passed to any model creating a SELECT query
*
*
* A hash of options to describe the scope of the search
* A hash of options to describe the scope of the search
*/
*/
export
interface
FindOptions
extends
QueryOptions
,
Filterable
,
Projectable
,
Paranoid
{
export
interface
FindOptions
extends
QueryOptions
,
Filterable
,
Projectable
,
Paranoid
,
IndexHintable
{
/**
/**
* A list of associations to eagerly load using a left join. Supported is either
* A list of associations to eagerly load using a left join. Supported is either
* `{ include: [ Model1, Model2, ...]}`, `{ include: [{ model: Model1, as: 'Alias' }]}` or
* `{ include: [ Model1, Model2, ...]}`, `{ include: [{ model: Model1, as: 'Alias' }]}` or
...
...
types/test/index-hints.ts
0 → 100644
View file @
99f396c
import
{
User
}
from
'models/User'
;
import
{
IndexHints
}
from
'..'
;
User
.
findAll
({
indexHints
:
[{
type
:
IndexHints
.
FORCE
,
value
:
[
'some_index'
],
}],
})
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