Types.hx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (C)2005-2012 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package sys.db;
  23. // basic types
  24. /** int with auto increment **/
  25. @:noPackageRestrict
  26. typedef SId = Null<Int>
  27. /** int unsigned with auto increment **/
  28. typedef SUId = Null<Int>
  29. /** big int with auto increment **/
  30. typedef SBigId = Null<Float>
  31. typedef SInt = Null<Int>
  32. typedef SUInt = Null<Int>
  33. typedef SBigInt = Null<Float>
  34. /** single precision float **/
  35. typedef SSingle = Null<Float>
  36. /** double precision float **/
  37. typedef SFloat = Null<Float>
  38. /** use tinyint(1) to distinguish with int **/
  39. typedef SBool = Null<Bool>
  40. /** same as varchar(n) **/
  41. typedef SString<Const> = String
  42. /** date only, use SDateTime for date+time **/
  43. typedef SDate = Date
  44. /** mysql DateTime **/
  45. typedef SDateTime = Date
  46. /** mysql Timestamp **/
  47. typedef STimeStamp = Date
  48. /** TinyText (up to 255 bytes) **/
  49. typedef STinyText = String
  50. /** Text (up to 64KB) **/
  51. typedef SSmallText = String
  52. /** MediumText (up to 24MB) **/
  53. typedef SText = String
  54. /** Blob type (up to 64KB) **/
  55. typedef SSmallBinary = haxe.io.Bytes
  56. /** LongBlob type (up to 4GB) **/
  57. typedef SLongBinary = haxe.io.Bytes
  58. /** MediumBlob type (up to 24MB) **/
  59. typedef SBinary = haxe.io.Bytes
  60. /** same as binary(n) **/
  61. typedef SBytes<Const> = haxe.io.Bytes
  62. /** one byte signed [-128...127] **/
  63. typedef STinyInt = Null<Int>
  64. /** two bytes signed [-32768...32767] **/
  65. typedef SSmallInt = Null<Int>
  66. /** three bytes signed [-8388608...8388607] **/
  67. typedef SMediumInt = Null<Int>
  68. /** one byte [0...255] **/
  69. typedef STinyUInt = Null<Int>
  70. /** two bytes [0...65535] **/
  71. typedef SSmallUInt = Null<Int>
  72. /** three bytes [0...16777215] **/
  73. typedef SMediumUInt = Null<Int>
  74. // extra
  75. /** specify that this field is nullable **/
  76. typedef SNull<T> = Null<T>
  77. /** specify that the integer use custom encoding **/
  78. typedef SEncoded = Null<Int>
  79. /** haxe Serialized string **/
  80. typedef SSerialized = String
  81. /** native neko serialized bytes **/
  82. typedef SNekoSerialized = haxe.io.Bytes
  83. /** a set of bitflags of different enum values **/
  84. typedef SFlags<T:EnumValue> = Null<haxe.EnumFlags<T>>
  85. /** same as [SFlags] but will adapt the storage size to the number of flags **/
  86. typedef SSmallFlags<T:EnumValue> = SFlags<T>;
  87. /** allow to store any value in serialized form **/
  88. typedef SData<T> = Null<T>
  89. /** allow to store an enum value that does not have parameters as a simple int **/
  90. typedef SEnum<E:EnumValue> = Null<E>