aliyun / aliyun-tablestore-nodejs-sdk

Aliyun TableStore(原OTS) SDK for Node.js
Apache License 2.0
88 stars 33 forks source link

建议: getRow 的返回结果中,attributes 中的 timestamp 值似乎没有必要使用 Long 数据类型 #4

Closed yi closed 7 years ago

yi commented 7 years ago

比如下面是一个 getTimeRange 获得到的记录结果

     attributes: 
      [ { columnName: 'accum_baoyue',
          columnValue: 0,
          timestamp: 
           Int64 {
             buffer: Buffer [ 100, 247, 254, 223, 93, 1, 0, 0 ],
             offset: 0 } },
        { columnName: 'accum_cpremium',
          columnValue: 0,
          timestamp: 
           Int64 {
             buffer: Buffer [ 100, 247, 254, 223, 93, 1, 0, 0 ],
             offset: 0 } },
        { columnName: 'accum_crealtime',
          columnValue: 0,
          timestamp: 
           Int64 {
             buffer: Buffer [ 100, 247, 254, 223, 93, 1, 0, 0 ],
             offset: 0 } },
        { columnName: 'accum_pmt_amount',
          columnValue: 0,
          timestamp: 
           Int64 {
             buffer: Buffer [ 100, 247, 254, 223, 93, 1, 0, 0 ],
             offset: 0 } },

其中的 timestamp 可以直接读成 Number。这样用起来会方便一些。

Unlike many other programming languages, JavaScript does not define different types of numbers, like integers, short, long, floating-point etc. JavaScript numbers are always stored as double precision floating point numbers, following the international IEEE 754 standard. This format stores numbers in 64 bits, where the number (the fraction) is stored in bits 0 to 51, the exponent in bits 52 to 62, and the sign in bit 63:

yi commented 7 years ago

请忽略