Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sails.js SailsJs模型使用postgresql支持长整数_Sails.js_Sails Postgresql - Fatal编程技术网

Sails.js SailsJs模型使用postgresql支持长整数

Sails.js SailsJs模型使用postgresql支持长整数,sails.js,sails-postgresql,Sails.js,Sails Postgresql,我在使用PostgreSQL数据库运行Sails应用程序时遇到问题。我需要插入一个11位数的整数,但是我找不到一个简单的方法来调整我的模型 编辑1 以下是一个模型示例: /** * Phone.js * * @docs :: http://sailsjs.org/#!documentation/models */ module.exports = { attributes: { number: { type: 'integ

我在使用PostgreSQL数据库运行Sails应用程序时遇到问题。我需要插入一个11位数的整数,但是我找不到一个简单的方法来调整我的模型

编辑1 以下是一个模型示例:

/**
 * Phone.js
 *
 * @docs        :: http://sailsjs.org/#!documentation/models
 */

module.exports = {

    attributes: {
        number: {
            type: 'integer',
            required: true,
            minLength: 9
        }
    }
};

有没有办法(使用ORM)在Postgre中将该整数更改为BIGINT,这样我就不会在插入时得到
错误:integer out-of-rage

根据这一点,您应该能够定义“BIGINT”作为类型


还支持浮点、实数、smallint等

根据这一点,您应该能够将“bigint”定义为类型


还支持浮点、实数、smallint等

在我的例子中,将type定义为bigint不起作用。在模型中创建条目时,我在验证中出错

但是,我给出了以下属性

type: string,
numeric: true,
minLength: 10

这已经足够好了,但并不完全符合我的要求。

将type定义为bigint在我的情况下不起作用。在模型中创建条目时,我在验证中出错

但是,我给出了以下属性

type: string,
numeric: true,
minLength: 10

这已经足够好了,但并不是我想要的。

将值作为字符串返回的原因是(2^63-1=9223372036854775807)比Javascript(2^53-1=9007199254740991)大得多因此,如果Sails/Waterline ORM始终将返回值转换为整数,则有可能破坏某些内容


因此,每次都返回一个字符串更安全。

将值作为字符串返回的原因是(2^63-1=9223372036854775807)比Javascript(2^53-1=9007199254740991)大得多,因此,如果Sails/Waterline ORM始终将返回值作为整数进行转换,则有可能破坏


因此,每次返回一个字符串更安全。

我可以通过设置以下属性使其工作:

type: 'ref',
columnType: 'int8',

我可以通过设置以下属性使其工作:

type: 'ref',
columnType: 'int8',

你能给我们看一下你的代码吗?你能给我们看一下你的代码吗?文件不断变化的规范链接:)文件不断变化的规范链接:)