constants.js 2.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * TDengine Field Types and their type codes
 * @typedef {Object} FieldTypes
 * @property {number} C_NULL - Null
 * @property {number} C_BOOL - Boolean. Note, 0x02 is the C_BOOL_NULL value.
 * @property {number} C_TINYINT - Tiny Int, values in the range [-2^7+1, 2^7-1]. Note, -2^7 has been used as the C_TINYINT_NULL value
 * @property {number} C_SMALLINT - Small Int, values in the range [-2^15+1, 2^15-1]. Note, -2^15 has been used as the C_SMALLINT_NULL value
 * @property {number} C_INT - Int, values in the range [-2^31+1, 2^31-1]. Note, -2^31 has been used as the C_INT_NULL value
 * @property {number} C_BIGINT - Big Int, values in the range [-2^59, 2^59].
 * @property {number} C_FLOAT - Float, values in the range [-3.4E38, 3.4E38], accurate up to 6-7 decimal places.
 * @property {number} C_DOUBLE - Double, values in the range [-1.7E308, 1.7E308], accurate up to 15-16 decimal places.
 * @property {number} C_BINARY - Binary, encoded in utf-8.
 * @property {number} C_TIMESTAMP - Timestamp in format "YYYY:MM:DD HH:MM:SS.MMM". Measured in number of milliseconds passed after
                                    1970-01-01 08:00:00.000 GMT.
 * @property {number} C_NCHAR - NChar field type encoded in ASCII, a wide string.
16 17
 *
 *
18 19 20
 *
 * @property {number} C_TIMESTAMP_MILLI - The code for millisecond timestamps, as returned by libtaos.taos_result_precision(result).
 * @property {number} C_TIMESTAMP_MICRO - The code for microsecond timestamps, as returned by libtaos.taos_result_precision(result).
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
 */
module.exports = {
    C_NULL : 0,
    C_BOOL : 1,
    C_TINYINT : 2,
    C_SMALLINT : 3,
    C_INT : 4,
    C_BIGINT : 5,
    C_FLOAT : 6,
    C_DOUBLE : 7,
    C_BINARY : 8,
    C_TIMESTAMP : 9,
    C_NCHAR : 10,
    // NULL value definition
    // NOTE: These values should change according to C definition in tsdb.h
    C_BOOL_NULL : 0x02,
    C_TINYINT_NULL : -128,
    C_SMALLINT_NULL : -32768,
    C_INT_NULL : -2147483648,
    C_BIGINT_NULL : -9223372036854775808,
41 42 43 44
    C_FLOAT_NULL : 2146435072,
    C_DOUBLE_NULL : -9223370937343148032,
    C_NCHAR_NULL : 4294967295,
    C_BINARY_NULL : 255,
45 46 47
    C_TIMESTAMP_MILLI : 0,
    C_TIMESTAMP_MICRO : 1,
}