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 6b82bee6
authored
Mar 23, 2019
by
Simon Schick
Committed by
Erik Seliger
Mar 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(typescript): add missing data types (#10607)
Fixes #10606
1 parent
d1c19582
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
22 deletions
types/lib/data-types.d.ts
types/test/data-types.ts
types/lib/data-types.d.ts
View file @
6b82bee
...
@@ -64,8 +64,6 @@ export interface AbstractDataType {
...
@@ -64,8 +64,6 @@ export interface AbstractDataType {
/**
/**
* A variable length string. Default length 255
* A variable length string. Default length 255
*
* Available properties: `BINARY`
*/
*/
export
const
STRING
:
StringDataTypeConstructor
;
export
const
STRING
:
StringDataTypeConstructor
;
...
@@ -89,9 +87,6 @@ export interface StringDataTypeOptions {
...
@@ -89,9 +87,6 @@ export interface StringDataTypeOptions {
/**
/**
* A fixed length string. Default length 255
* A fixed length string. Default length 255
*
* Available properties: `BINARY`
*
*/
*/
export
const
CHAR
:
CharDataTypeConstructor
;
export
const
CHAR
:
CharDataTypeConstructor
;
...
@@ -145,20 +140,61 @@ export interface NumberDataType extends AbstractDataType {
...
@@ -145,20 +140,61 @@ export interface NumberDataType extends AbstractDataType {
validate
(
value
:
unknown
):
boolean
;
validate
(
value
:
unknown
):
boolean
;
}
}
export
interface
Numb
erDataTypeOptions
{
export
interface
Integ
erDataTypeOptions
{
length
?:
number
;
length
?:
number
;
zerofill
?:
boolean
;
zerofill
?:
boolean
;
unsigned
?:
boolean
;
}
export
interface
NumberDataTypeOptions
extends
IntegerDataTypeOptions
{
decimals
?:
number
;
decimals
?:
number
;
precision
?:
number
;
precision
?:
number
;
scale
?:
number
;
scale
?:
number
;
unsigned
?:
boolean
;
}
/**
* A 8 bit integer.
*/
export
const
TINYINT
:
TinyIntegerDataTypeConstructor
;
interface
TinyIntegerDataTypeConstructor
extends
NumberDataTypeConstructor
{
new
(
options
?:
IntegerDataTypeOptions
):
TinyIntegerDataType
;
(
options
?:
IntegerDataTypeOptions
):
TinyIntegerDataType
;
}
export
interface
TinyIntegerDataType
extends
NumberDataType
{
options
:
IntegerDataTypeOptions
;
}
/**
* A 16 bit integer.
*/
export
const
SMALLINT
:
SmallIntegerDataTypeConstructor
;
interface
SmallIntegerDataTypeConstructor
extends
NumberDataTypeConstructor
{
new
(
options
?:
IntegerDataTypeOptions
):
SmallIntegerDataType
;
(
options
?:
IntegerDataTypeOptions
):
SmallIntegerDataType
;
}
export
interface
SmallIntegerDataType
extends
NumberDataType
{
options
:
IntegerDataTypeOptions
;
}
/**
* A 24 bit integer.
*/
export
const
MEDIUMINT
:
MediumIntegerDataTypeConstructor
;
interface
MediumIntegerDataTypeConstructor
extends
NumberDataTypeConstructor
{
new
(
options
?:
IntegerDataTypeOptions
):
MediumIntegerDataType
;
(
options
?:
IntegerDataTypeOptions
):
MediumIntegerDataType
;
}
export
interface
MediumIntegerDataType
extends
NumberDataType
{
options
:
IntegerDataTypeOptions
;
}
}
/**
/**
* A 32 bit integer.
* A 32 bit integer.
*
* Available properties: `UNSIGNED`, `ZEROFILL`
*
*/
*/
export
const
INTEGER
:
IntegerDataTypeConstructor
;
export
const
INTEGER
:
IntegerDataTypeConstructor
;
...
@@ -171,10 +207,6 @@ export interface IntegerDataType extends NumberDataType {
...
@@ -171,10 +207,6 @@ export interface IntegerDataType extends NumberDataType {
options
:
NumberDataTypeOptions
;
options
:
NumberDataTypeOptions
;
}
}
export
interface
IntegerDataTypeOptions
{
length
?:
number
;
}
/**
/**
* A 64 bit integer.
* A 64 bit integer.
*
*
...
@@ -184,16 +216,12 @@ export interface IntegerDataTypeOptions {
...
@@ -184,16 +216,12 @@ export interface IntegerDataTypeOptions {
export
const
BIGINT
:
BigIntDataTypeConstructor
;
export
const
BIGINT
:
BigIntDataTypeConstructor
;
interface
BigIntDataTypeConstructor
extends
NumberDataTypeConstructor
{
interface
BigIntDataTypeConstructor
extends
NumberDataTypeConstructor
{
new
(
options
?:
BigInt
DataTypeOptions
):
BigIntDataType
;
new
(
options
?:
Integer
DataTypeOptions
):
BigIntDataType
;
(
options
?:
BigInt
DataTypeOptions
):
BigIntDataType
;
(
options
?:
Integer
DataTypeOptions
):
BigIntDataType
;
}
}
export
interface
BigIntDataType
extends
NumberDataType
{
export
interface
BigIntDataType
extends
NumberDataType
{
options
:
BigIntDataTypeOptions
;
options
:
IntegerDataTypeOptions
;
}
export
interface
BigIntDataTypeOptions
{
length
?:
number
;
}
}
/**
/**
...
@@ -576,6 +604,5 @@ export const MACADDR: AbstractDataTypeConstructor;
...
@@ -576,6 +604,5 @@ export const MACADDR: AbstractDataTypeConstructor;
*/
*/
export
const
CITEXT
:
AbstractDataTypeConstructor
;
export
const
CITEXT
:
AbstractDataTypeConstructor
;
// umzug compatibility
// umzug compatibility
export
type
DataTypeAbstract
=
AbstractDataTypeConstructor
;
export
type
DataTypeAbstract
=
AbstractDataTypeConstructor
;
types/test/data-types.ts
0 → 100644
View file @
6b82bee
import
{
INTEGER
,
IntegerDataType
,
TINYINT
}
from
'sequelize'
;
import
{
SmallIntegerDataType
,
SMALLINT
,
MEDIUMINT
,
MediumIntegerDataType
,
BigIntDataType
,
BIGINT
}
from
'../lib/data-types'
;
let
tinyint
:
IntegerDataType
;
tinyint
=
TINYINT
();
tinyint
=
new
TINYINT
();
tinyint
=
TINYINT
.
UNSIGNED
.
ZEROFILL
();
tinyint
=
new
TINYINT
.
UNSIGNED
.
ZEROFILL
();
let
smallint
:
SmallIntegerDataType
;
smallint
=
SMALLINT
();
smallint
=
new
SMALLINT
();
smallint
=
SMALLINT
.
UNSIGNED
.
ZEROFILL
();
smallint
=
new
SMALLINT
.
UNSIGNED
.
ZEROFILL
();
let
mediumint
:
MediumIntegerDataType
;
mediumint
=
MEDIUMINT
();
mediumint
=
new
MEDIUMINT
();
mediumint
=
MEDIUMINT
.
UNSIGNED
.
ZEROFILL
();
mediumint
=
new
MEDIUMINT
.
UNSIGNED
.
ZEROFILL
();
let
int
:
IntegerDataType
;
int
=
INTEGER
();
int
=
new
INTEGER
();
int
=
INTEGER
.
UNSIGNED
.
ZEROFILL
();
int
=
new
INTEGER
.
UNSIGNED
.
ZEROFILL
();
let
bigint
:
BigIntDataType
;
bigint
=
BIGINT
();
bigint
=
new
BIGINT
();
bigint
=
BIGINT
.
UNSIGNED
.
ZEROFILL
();
bigint
=
new
BIGINT
.
UNSIGNED
.
ZEROFILL
();
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