PrimitiveTypeId.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_value.proto
  4. namespace Ydb\Type;
  5. use UnexpectedValueException;
  6. /**
  7. * Protobuf type <code>Ydb.Type.PrimitiveTypeId</code>
  8. */
  9. class PrimitiveTypeId
  10. {
  11. /**
  12. * Generated from protobuf enum <code>PRIMITIVE_TYPE_ID_UNSPECIFIED = 0;</code>
  13. */
  14. const PRIMITIVE_TYPE_ID_UNSPECIFIED = 0;
  15. /**
  16. * Generated from protobuf enum <code>BOOL = 6;</code>
  17. */
  18. const BOOL = 6;
  19. /**
  20. * Generated from protobuf enum <code>INT8 = 7;</code>
  21. */
  22. const INT8 = 7;
  23. /**
  24. * Generated from protobuf enum <code>UINT8 = 5;</code>
  25. */
  26. const UINT8 = 5;
  27. /**
  28. * Generated from protobuf enum <code>INT16 = 8;</code>
  29. */
  30. const INT16 = 8;
  31. /**
  32. * Generated from protobuf enum <code>UINT16 = 9;</code>
  33. */
  34. const UINT16 = 9;
  35. /**
  36. * Generated from protobuf enum <code>INT32 = 1;</code>
  37. */
  38. const INT32 = 1;
  39. /**
  40. * Generated from protobuf enum <code>UINT32 = 2;</code>
  41. */
  42. const UINT32 = 2;
  43. /**
  44. * Generated from protobuf enum <code>INT64 = 3;</code>
  45. */
  46. const INT64 = 3;
  47. /**
  48. * Generated from protobuf enum <code>UINT64 = 4;</code>
  49. */
  50. const UINT64 = 4;
  51. /**
  52. * Generated from protobuf enum <code>FLOAT = 33;</code>
  53. */
  54. const FLOAT = 33;
  55. /**
  56. * Generated from protobuf enum <code>DOUBLE = 32;</code>
  57. */
  58. const DOUBLE = 32;
  59. /**
  60. * Generated from protobuf enum <code>DATE = 48;</code>
  61. */
  62. const DATE = 48;
  63. /**
  64. * Generated from protobuf enum <code>DATETIME = 49;</code>
  65. */
  66. const DATETIME = 49;
  67. /**
  68. * Generated from protobuf enum <code>TIMESTAMP = 50;</code>
  69. */
  70. const TIMESTAMP = 50;
  71. /**
  72. * Generated from protobuf enum <code>INTERVAL = 51;</code>
  73. */
  74. const INTERVAL = 51;
  75. /**
  76. * Generated from protobuf enum <code>TZ_DATE = 52;</code>
  77. */
  78. const TZ_DATE = 52;
  79. /**
  80. * Generated from protobuf enum <code>TZ_DATETIME = 53;</code>
  81. */
  82. const TZ_DATETIME = 53;
  83. /**
  84. * Generated from protobuf enum <code>TZ_TIMESTAMP = 54;</code>
  85. */
  86. const TZ_TIMESTAMP = 54;
  87. /**
  88. * Generated from protobuf enum <code>STRING = 4097;</code>
  89. */
  90. const STRING = 4097;
  91. /**
  92. * Generated from protobuf enum <code>UTF8 = 4608;</code>
  93. */
  94. const UTF8 = 4608;
  95. /**
  96. * Generated from protobuf enum <code>YSON = 4609;</code>
  97. */
  98. const YSON = 4609;
  99. /**
  100. * Generated from protobuf enum <code>JSON = 4610;</code>
  101. */
  102. const JSON = 4610;
  103. /**
  104. * Generated from protobuf enum <code>UUID = 4611;</code>
  105. */
  106. const UUID = 4611;
  107. /**
  108. * Generated from protobuf enum <code>JSON_DOCUMENT = 4612;</code>
  109. */
  110. const JSON_DOCUMENT = 4612;
  111. /**
  112. * Generated from protobuf enum <code>DYNUMBER = 4866;</code>
  113. */
  114. const DYNUMBER = 4866;
  115. private static $valueToName = [
  116. self::PRIMITIVE_TYPE_ID_UNSPECIFIED => 'PRIMITIVE_TYPE_ID_UNSPECIFIED',
  117. self::BOOL => 'BOOL',
  118. self::INT8 => 'INT8',
  119. self::UINT8 => 'UINT8',
  120. self::INT16 => 'INT16',
  121. self::UINT16 => 'UINT16',
  122. self::INT32 => 'INT32',
  123. self::UINT32 => 'UINT32',
  124. self::INT64 => 'INT64',
  125. self::UINT64 => 'UINT64',
  126. self::FLOAT => 'FLOAT',
  127. self::DOUBLE => 'DOUBLE',
  128. self::DATE => 'DATE',
  129. self::DATETIME => 'DATETIME',
  130. self::TIMESTAMP => 'TIMESTAMP',
  131. self::INTERVAL => 'INTERVAL',
  132. self::TZ_DATE => 'TZ_DATE',
  133. self::TZ_DATETIME => 'TZ_DATETIME',
  134. self::TZ_TIMESTAMP => 'TZ_TIMESTAMP',
  135. self::STRING => 'STRING',
  136. self::UTF8 => 'UTF8',
  137. self::YSON => 'YSON',
  138. self::JSON => 'JSON',
  139. self::UUID => 'UUID',
  140. self::JSON_DOCUMENT => 'JSON_DOCUMENT',
  141. self::DYNUMBER => 'DYNUMBER',
  142. ];
  143. public static function name($value)
  144. {
  145. if (!isset(self::$valueToName[$value])) {
  146. throw new UnexpectedValueException(sprintf(
  147. 'Enum %s has no name defined for value %s', __CLASS__, $value));
  148. }
  149. return self::$valueToName[$value];
  150. }
  151. public static function value($name)
  152. {
  153. $const = __CLASS__ . '::' . strtoupper($name);
  154. if (!defined($const)) {
  155. throw new UnexpectedValueException(sprintf(
  156. 'Enum %s has no value defined for name %s', __CLASS__, $name));
  157. }
  158. return constant($const);
  159. }
  160. }
  161. // Adding a class alias for backwards compatibility with the previous class name.
  162. class_alias(PrimitiveTypeId::class, \Ydb\Type_PrimitiveTypeId::class);