const.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package sqltypes
  2. // copied from vitness
  3. // Flag allows us to qualify types by their common properties.
  4. type Flag int32
  5. const (
  6. Flag_NONE Flag = 0
  7. Flag_ISINTEGRAL Flag = 256
  8. Flag_ISUNSIGNED Flag = 512
  9. Flag_ISFLOAT Flag = 1024
  10. Flag_ISQUOTED Flag = 2048
  11. Flag_ISTEXT Flag = 4096
  12. Flag_ISBINARY Flag = 8192
  13. )
  14. var Flag_name = map[int32]string{
  15. 0: "NONE",
  16. 256: "ISINTEGRAL",
  17. 512: "ISUNSIGNED",
  18. 1024: "ISFLOAT",
  19. 2048: "ISQUOTED",
  20. 4096: "ISTEXT",
  21. 8192: "ISBINARY",
  22. }
  23. var Flag_value = map[string]int32{
  24. "NONE": 0,
  25. "ISINTEGRAL": 256,
  26. "ISUNSIGNED": 512,
  27. "ISFLOAT": 1024,
  28. "ISQUOTED": 2048,
  29. "ISTEXT": 4096,
  30. "ISBINARY": 8192,
  31. }
  32. // Type defines the various supported data types in bind vars
  33. // and query results.
  34. type Type int32
  35. const (
  36. // NULL_TYPE specifies a NULL type.
  37. Type_NULL_TYPE Type = 0
  38. // INT8 specifies a TINYINT type.
  39. // Properties: 1, IsNumber.
  40. Type_INT8 Type = 257
  41. // UINT8 specifies a TINYINT UNSIGNED type.
  42. // Properties: 2, IsNumber, IsUnsigned.
  43. Type_UINT8 Type = 770
  44. // INT16 specifies a SMALLINT type.
  45. // Properties: 3, IsNumber.
  46. Type_INT16 Type = 259
  47. // UINT16 specifies a SMALLINT UNSIGNED type.
  48. // Properties: 4, IsNumber, IsUnsigned.
  49. Type_UINT16 Type = 772
  50. // INT24 specifies a MEDIUMINT type.
  51. // Properties: 5, IsNumber.
  52. Type_INT32 Type = 263
  53. // UINT32 specifies a INTEGER UNSIGNED type.
  54. // Properties: 8, IsNumber, IsUnsigned.
  55. Type_UINT32 Type = 776
  56. // INT64 specifies a BIGINT type.
  57. // Properties: 9, IsNumber.
  58. Type_INT64 Type = 265
  59. // UINT64 specifies a BIGINT UNSIGNED type.
  60. // Properties: 10, IsNumber, IsUnsigned.
  61. Type_UINT64 Type = 778
  62. // FLOAT32 specifies a FLOAT type.
  63. // Properties: 11, IsFloat.
  64. Type_FLOAT32 Type = 1035
  65. // FLOAT64 specifies a DOUBLE or REAL type.
  66. // Properties: 12, IsFloat.
  67. Type_FLOAT64 Type = 1036
  68. // TIMESTAMP specifies a TIMESTAMP type.
  69. // Properties: 13, IsQuoted.
  70. Type_TIMESTAMP Type = 2061
  71. // DATE specifies a DATE type.
  72. // Properties: 14, IsQuoted.
  73. Type_DATE Type = 2062
  74. // TIME specifies a TIME type.
  75. // Properties: 15, IsQuoted.
  76. Type_TIME Type = 2063
  77. // DATETIME specifies a DATETIME type.
  78. // Properties: 16, IsQuoted.
  79. Type_DATETIME Type = 2064
  80. // YEAR specifies a YEAR type.
  81. // Properties: 17, IsNumber, IsUnsigned.
  82. Type_YEAR Type = 785
  83. // DECIMAL specifies a DECIMAL or NUMERIC type.
  84. // Properties: 18, None.
  85. Type_DECIMAL Type = 18
  86. // TEXT specifies a TEXT type.
  87. // Properties: 19, IsQuoted, IsText.
  88. Type_TEXT Type = 6163
  89. // BLOB specifies a BLOB type.
  90. // Properties: 20, IsQuoted, IsBinary.
  91. Type_BLOB Type = 10260
  92. // VARCHAR specifies a VARCHAR type.
  93. // Properties: 21, IsQuoted, IsText.
  94. Type_VARCHAR Type = 6165
  95. // VARBINARY specifies a VARBINARY type.
  96. // Properties: 22, IsQuoted, IsBinary.
  97. Type_VARBINARY Type = 10262
  98. // CHAR specifies a CHAR type.
  99. // Properties: 23, IsQuoted, IsText.
  100. Type_CHAR Type = 6167
  101. // BINARY specifies a BINARY type.
  102. // Properties: 24, IsQuoted, IsBinary.
  103. Type_BINARY Type = 10264
  104. // BIT specifies a BIT type.
  105. // Properties: 25, IsQuoted.
  106. Type_BIT Type = 2073
  107. // JSON specifies a JSON type.
  108. // Properties: 30, IsQuoted.
  109. Type_JSON Type = 2078
  110. )
  111. // BindVariable represents a single bind variable in a Query.
  112. type BindVariable struct {
  113. Type Type `protobuf:"varint,1,opt,name=type,enum=query.Type" json:"type,omitempty"`
  114. Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
  115. // values are set if type is TUPLE.
  116. Values []*Value `protobuf:"bytes,3,rep,name=values" json:"values,omitempty"`
  117. }