planetscale 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +24 -0
  3. data/.github/workflows/gem-push.yml +38 -0
  4. data/.github/workflows/licensed.yml +43 -0
  5. data/.gitignore +10 -0
  6. data/.licensed.yml +9 -0
  7. data/.licenses/go/github.com/armon/circbuf.dep.yml +31 -0
  8. data/.licenses/go/github.com/gorilla/mux.dep.yml +41 -0
  9. data/.licenses/go/github.com/hashicorp/go-cleanhttp.dep.yml +375 -0
  10. data/.licenses/go/github.com/mitchellh/go-homedir.dep.yml +32 -0
  11. data/.licenses/go/github.com/pkg/errors.dep.yml +36 -0
  12. data/.licenses/go/github.com/planetscale/planetscale-go/planetscale.dep.yml +160 -0
  13. data/.licenses/go/github.com/planetscale/sql-proxy/proxy.dep.yml +180 -0
  14. data/.licenses/go/go.uber.org/atomic.dep.yml +31 -0
  15. data/.licenses/go/go.uber.org/multierr.dep.yml +30 -0
  16. data/.licenses/go/go.uber.org/zap.dep.yml +30 -0
  17. data/.licenses/go/go.uber.org/zap/buffer.dep.yml +30 -0
  18. data/.licenses/go/go.uber.org/zap/internal/bufferpool.dep.yml +30 -0
  19. data/.licenses/go/go.uber.org/zap/internal/color.dep.yml +30 -0
  20. data/.licenses/go/go.uber.org/zap/internal/exit.dep.yml +31 -0
  21. data/.licenses/go/go.uber.org/zap/zapcore.dep.yml +31 -0
  22. data/.licenses/go/golang.org/x/net/context/ctxhttp.dep.yml +63 -0
  23. data/.licenses/go/golang.org/x/oauth2.dep.yml +44 -0
  24. data/.licenses/go/golang.org/x/oauth2/internal.dep.yml +38 -0
  25. data/.ruby_version +1 -0
  26. data/Gemfile +8 -0
  27. data/LICENSE +201 -0
  28. data/README.md +88 -0
  29. data/Rakefile +10 -0
  30. data/bin/console +15 -0
  31. data/bin/setup +17 -0
  32. data/controller.go +255 -0
  33. data/go.mod +16 -0
  34. data/go.sum +428 -0
  35. data/lib/generators/planetscale/install_generator.rb +58 -0
  36. data/lib/planetscale.rb +137 -0
  37. data/lib/planetscale/version.rb +5 -0
  38. data/planetscale.gemspec +44 -0
  39. data/proxy.go +128 -0
  40. data/vendor/github.com/armon/circbuf/.gitignore +22 -0
  41. data/vendor/github.com/armon/circbuf/LICENSE +20 -0
  42. data/vendor/github.com/armon/circbuf/README.md +28 -0
  43. data/vendor/github.com/armon/circbuf/circbuf.go +92 -0
  44. data/vendor/github.com/armon/circbuf/go.mod +1 -0
  45. data/vendor/github.com/golang/protobuf/AUTHORS +3 -0
  46. data/vendor/github.com/golang/protobuf/CONTRIBUTORS +3 -0
  47. data/vendor/github.com/golang/protobuf/LICENSE +28 -0
  48. data/vendor/github.com/golang/protobuf/proto/buffer.go +324 -0
  49. data/vendor/github.com/golang/protobuf/proto/defaults.go +63 -0
  50. data/vendor/github.com/golang/protobuf/proto/deprecated.go +113 -0
  51. data/vendor/github.com/golang/protobuf/proto/discard.go +58 -0
  52. data/vendor/github.com/golang/protobuf/proto/extensions.go +356 -0
  53. data/vendor/github.com/golang/protobuf/proto/properties.go +306 -0
  54. data/vendor/github.com/golang/protobuf/proto/proto.go +167 -0
  55. data/vendor/github.com/golang/protobuf/proto/registry.go +317 -0
  56. data/vendor/github.com/golang/protobuf/proto/text_decode.go +801 -0
  57. data/vendor/github.com/golang/protobuf/proto/text_encode.go +560 -0
  58. data/vendor/github.com/golang/protobuf/proto/wire.go +78 -0
  59. data/vendor/github.com/golang/protobuf/proto/wrappers.go +34 -0
  60. data/vendor/github.com/gorilla/mux/AUTHORS +8 -0
  61. data/vendor/github.com/gorilla/mux/LICENSE +27 -0
  62. data/vendor/github.com/gorilla/mux/README.md +805 -0
  63. data/vendor/github.com/gorilla/mux/doc.go +306 -0
  64. data/vendor/github.com/gorilla/mux/go.mod +3 -0
  65. data/vendor/github.com/gorilla/mux/middleware.go +74 -0
  66. data/vendor/github.com/gorilla/mux/mux.go +606 -0
  67. data/vendor/github.com/gorilla/mux/regexp.go +388 -0
  68. data/vendor/github.com/gorilla/mux/route.go +736 -0
  69. data/vendor/github.com/gorilla/mux/test_helpers.go +19 -0
  70. data/vendor/github.com/hashicorp/go-cleanhttp/LICENSE +363 -0
  71. data/vendor/github.com/hashicorp/go-cleanhttp/README.md +30 -0
  72. data/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go +58 -0
  73. data/vendor/github.com/hashicorp/go-cleanhttp/doc.go +20 -0
  74. data/vendor/github.com/hashicorp/go-cleanhttp/go.mod +3 -0
  75. data/vendor/github.com/hashicorp/go-cleanhttp/handlers.go +48 -0
  76. data/vendor/github.com/mitchellh/go-homedir/LICENSE +21 -0
  77. data/vendor/github.com/mitchellh/go-homedir/README.md +14 -0
  78. data/vendor/github.com/mitchellh/go-homedir/go.mod +1 -0
  79. data/vendor/github.com/mitchellh/go-homedir/homedir.go +167 -0
  80. data/vendor/github.com/pkg/errors/.gitignore +24 -0
  81. data/vendor/github.com/pkg/errors/.travis.yml +10 -0
  82. data/vendor/github.com/pkg/errors/LICENSE +23 -0
  83. data/vendor/github.com/pkg/errors/Makefile +44 -0
  84. data/vendor/github.com/pkg/errors/README.md +59 -0
  85. data/vendor/github.com/pkg/errors/appveyor.yml +32 -0
  86. data/vendor/github.com/pkg/errors/errors.go +288 -0
  87. data/vendor/github.com/pkg/errors/go113.go +38 -0
  88. data/vendor/github.com/pkg/errors/stack.go +177 -0
  89. data/vendor/github.com/planetscale/planetscale-go/planetscale/backups.go +139 -0
  90. data/vendor/github.com/planetscale/planetscale-go/planetscale/branches.go +258 -0
  91. data/vendor/github.com/planetscale/planetscale-go/planetscale/certs.go +142 -0
  92. data/vendor/github.com/planetscale/planetscale-go/planetscale/client.go +305 -0
  93. data/vendor/github.com/planetscale/planetscale-go/planetscale/databases.go +131 -0
  94. data/vendor/github.com/planetscale/planetscale-go/planetscale/deploy_requests.go +368 -0
  95. data/vendor/github.com/planetscale/planetscale-go/planetscale/organizations.go +78 -0
  96. data/vendor/github.com/planetscale/planetscale-go/planetscale/service_tokens.go +163 -0
  97. data/vendor/github.com/planetscale/sql-proxy/proxy/client.go +467 -0
  98. data/vendor/github.com/planetscale/sql-proxy/proxy/tls_cache.go +73 -0
  99. data/vendor/go.uber.org/atomic/.codecov.yml +19 -0
  100. data/vendor/go.uber.org/atomic/.gitignore +12 -0
  101. data/vendor/go.uber.org/atomic/.travis.yml +27 -0
  102. data/vendor/go.uber.org/atomic/CHANGELOG.md +76 -0
  103. data/vendor/go.uber.org/atomic/LICENSE.txt +19 -0
  104. data/vendor/go.uber.org/atomic/Makefile +78 -0
  105. data/vendor/go.uber.org/atomic/README.md +63 -0
  106. data/vendor/go.uber.org/atomic/bool.go +81 -0
  107. data/vendor/go.uber.org/atomic/bool_ext.go +53 -0
  108. data/vendor/go.uber.org/atomic/doc.go +23 -0
  109. data/vendor/go.uber.org/atomic/duration.go +82 -0
  110. data/vendor/go.uber.org/atomic/duration_ext.go +40 -0
  111. data/vendor/go.uber.org/atomic/error.go +51 -0
  112. data/vendor/go.uber.org/atomic/error_ext.go +39 -0
  113. data/vendor/go.uber.org/atomic/float64.go +76 -0
  114. data/vendor/go.uber.org/atomic/float64_ext.go +47 -0
  115. data/vendor/go.uber.org/atomic/gen.go +26 -0
  116. data/vendor/go.uber.org/atomic/go.mod +8 -0
  117. data/vendor/go.uber.org/atomic/go.sum +9 -0
  118. data/vendor/go.uber.org/atomic/int32.go +102 -0
  119. data/vendor/go.uber.org/atomic/int64.go +102 -0
  120. data/vendor/go.uber.org/atomic/nocmp.go +35 -0
  121. data/vendor/go.uber.org/atomic/string.go +54 -0
  122. data/vendor/go.uber.org/atomic/string_ext.go +43 -0
  123. data/vendor/go.uber.org/atomic/uint32.go +102 -0
  124. data/vendor/go.uber.org/atomic/uint64.go +102 -0
  125. data/vendor/go.uber.org/atomic/value.go +31 -0
  126. data/vendor/go.uber.org/multierr/.codecov.yml +15 -0
  127. data/vendor/go.uber.org/multierr/.gitignore +4 -0
  128. data/vendor/go.uber.org/multierr/.travis.yml +23 -0
  129. data/vendor/go.uber.org/multierr/CHANGELOG.md +60 -0
  130. data/vendor/go.uber.org/multierr/LICENSE.txt +19 -0
  131. data/vendor/go.uber.org/multierr/Makefile +42 -0
  132. data/vendor/go.uber.org/multierr/README.md +23 -0
  133. data/vendor/go.uber.org/multierr/error.go +449 -0
  134. data/vendor/go.uber.org/multierr/glide.yaml +8 -0
  135. data/vendor/go.uber.org/multierr/go.mod +8 -0
  136. data/vendor/go.uber.org/multierr/go.sum +11 -0
  137. data/vendor/go.uber.org/multierr/go113.go +52 -0
  138. data/vendor/go.uber.org/zap/.codecov.yml +17 -0
  139. data/vendor/go.uber.org/zap/.gitignore +32 -0
  140. data/vendor/go.uber.org/zap/.readme.tmpl +109 -0
  141. data/vendor/go.uber.org/zap/.travis.yml +23 -0
  142. data/vendor/go.uber.org/zap/CHANGELOG.md +432 -0
  143. data/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +75 -0
  144. data/vendor/go.uber.org/zap/CONTRIBUTING.md +81 -0
  145. data/vendor/go.uber.org/zap/FAQ.md +156 -0
  146. data/vendor/go.uber.org/zap/LICENSE.txt +19 -0
  147. data/vendor/go.uber.org/zap/Makefile +63 -0
  148. data/vendor/go.uber.org/zap/README.md +134 -0
  149. data/vendor/go.uber.org/zap/array.go +320 -0
  150. data/vendor/go.uber.org/zap/buffer/buffer.go +123 -0
  151. data/vendor/go.uber.org/zap/buffer/pool.go +49 -0
  152. data/vendor/go.uber.org/zap/checklicense.sh +17 -0
  153. data/vendor/go.uber.org/zap/config.go +264 -0
  154. data/vendor/go.uber.org/zap/doc.go +113 -0
  155. data/vendor/go.uber.org/zap/encoder.go +79 -0
  156. data/vendor/go.uber.org/zap/error.go +80 -0
  157. data/vendor/go.uber.org/zap/field.go +539 -0
  158. data/vendor/go.uber.org/zap/flag.go +39 -0
  159. data/vendor/go.uber.org/zap/glide.yaml +34 -0
  160. data/vendor/go.uber.org/zap/global.go +168 -0
  161. data/vendor/go.uber.org/zap/global_go112.go +26 -0
  162. data/vendor/go.uber.org/zap/global_prego112.go +26 -0
  163. data/vendor/go.uber.org/zap/go.mod +13 -0
  164. data/vendor/go.uber.org/zap/go.sum +56 -0
  165. data/vendor/go.uber.org/zap/http_handler.go +81 -0
  166. data/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go +31 -0
  167. data/vendor/go.uber.org/zap/internal/color/color.go +44 -0
  168. data/vendor/go.uber.org/zap/internal/exit/exit.go +64 -0
  169. data/vendor/go.uber.org/zap/level.go +132 -0
  170. data/vendor/go.uber.org/zap/logger.go +344 -0
  171. data/vendor/go.uber.org/zap/options.go +140 -0
  172. data/vendor/go.uber.org/zap/sink.go +161 -0
  173. data/vendor/go.uber.org/zap/stacktrace.go +85 -0
  174. data/vendor/go.uber.org/zap/sugar.go +304 -0
  175. data/vendor/go.uber.org/zap/time.go +27 -0
  176. data/vendor/go.uber.org/zap/writer.go +99 -0
  177. data/vendor/go.uber.org/zap/zapcore/console_encoder.go +161 -0
  178. data/vendor/go.uber.org/zap/zapcore/core.go +113 -0
  179. data/vendor/go.uber.org/zap/zapcore/doc.go +24 -0
  180. data/vendor/go.uber.org/zap/zapcore/encoder.go +443 -0
  181. data/vendor/go.uber.org/zap/zapcore/entry.go +264 -0
  182. data/vendor/go.uber.org/zap/zapcore/error.go +115 -0
  183. data/vendor/go.uber.org/zap/zapcore/field.go +227 -0
  184. data/vendor/go.uber.org/zap/zapcore/hook.go +68 -0
  185. data/vendor/go.uber.org/zap/zapcore/increase_level.go +66 -0
  186. data/vendor/go.uber.org/zap/zapcore/json_encoder.go +534 -0
  187. data/vendor/go.uber.org/zap/zapcore/level.go +175 -0
  188. data/vendor/go.uber.org/zap/zapcore/level_strings.go +46 -0
  189. data/vendor/go.uber.org/zap/zapcore/marshaler.go +61 -0
  190. data/vendor/go.uber.org/zap/zapcore/memory_encoder.go +179 -0
  191. data/vendor/go.uber.org/zap/zapcore/sampler.go +208 -0
  192. data/vendor/go.uber.org/zap/zapcore/tee.go +81 -0
  193. data/vendor/go.uber.org/zap/zapcore/write_syncer.go +123 -0
  194. data/vendor/golang.org/x/net/AUTHORS +3 -0
  195. data/vendor/golang.org/x/net/CONTRIBUTORS +3 -0
  196. data/vendor/golang.org/x/net/LICENSE +27 -0
  197. data/vendor/golang.org/x/net/PATENTS +22 -0
  198. data/vendor/golang.org/x/net/context/context.go +56 -0
  199. data/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +71 -0
  200. data/vendor/golang.org/x/net/context/go17.go +73 -0
  201. data/vendor/golang.org/x/net/context/go19.go +21 -0
  202. data/vendor/golang.org/x/net/context/pre_go17.go +301 -0
  203. data/vendor/golang.org/x/net/context/pre_go19.go +110 -0
  204. data/vendor/golang.org/x/oauth2/.travis.yml +13 -0
  205. data/vendor/golang.org/x/oauth2/AUTHORS +3 -0
  206. data/vendor/golang.org/x/oauth2/CONTRIBUTING.md +26 -0
  207. data/vendor/golang.org/x/oauth2/CONTRIBUTORS +3 -0
  208. data/vendor/golang.org/x/oauth2/LICENSE +27 -0
  209. data/vendor/golang.org/x/oauth2/README.md +36 -0
  210. data/vendor/golang.org/x/oauth2/go.mod +9 -0
  211. data/vendor/golang.org/x/oauth2/go.sum +361 -0
  212. data/vendor/golang.org/x/oauth2/internal/client_appengine.go +14 -0
  213. data/vendor/golang.org/x/oauth2/internal/doc.go +6 -0
  214. data/vendor/golang.org/x/oauth2/internal/oauth2.go +37 -0
  215. data/vendor/golang.org/x/oauth2/internal/token.go +294 -0
  216. data/vendor/golang.org/x/oauth2/internal/transport.go +33 -0
  217. data/vendor/golang.org/x/oauth2/oauth2.go +381 -0
  218. data/vendor/golang.org/x/oauth2/token.go +178 -0
  219. data/vendor/golang.org/x/oauth2/transport.go +89 -0
  220. data/vendor/google.golang.org/appengine/LICENSE +202 -0
  221. data/vendor/google.golang.org/appengine/internal/api.go +678 -0
  222. data/vendor/google.golang.org/appengine/internal/api_classic.go +169 -0
  223. data/vendor/google.golang.org/appengine/internal/api_common.go +123 -0
  224. data/vendor/google.golang.org/appengine/internal/app_id.go +28 -0
  225. data/vendor/google.golang.org/appengine/internal/base/api_base.pb.go +308 -0
  226. data/vendor/google.golang.org/appengine/internal/base/api_base.proto +33 -0
  227. data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go +4367 -0
  228. data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto +551 -0
  229. data/vendor/google.golang.org/appengine/internal/identity.go +55 -0
  230. data/vendor/google.golang.org/appengine/internal/identity_classic.go +61 -0
  231. data/vendor/google.golang.org/appengine/internal/identity_flex.go +11 -0
  232. data/vendor/google.golang.org/appengine/internal/identity_vm.go +134 -0
  233. data/vendor/google.golang.org/appengine/internal/internal.go +110 -0
  234. data/vendor/google.golang.org/appengine/internal/log/log_service.pb.go +1313 -0
  235. data/vendor/google.golang.org/appengine/internal/log/log_service.proto +150 -0
  236. data/vendor/google.golang.org/appengine/internal/main.go +16 -0
  237. data/vendor/google.golang.org/appengine/internal/main_common.go +7 -0
  238. data/vendor/google.golang.org/appengine/internal/main_vm.go +69 -0
  239. data/vendor/google.golang.org/appengine/internal/metadata.go +60 -0
  240. data/vendor/google.golang.org/appengine/internal/net.go +56 -0
  241. data/vendor/google.golang.org/appengine/internal/regen.sh +40 -0
  242. data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go +361 -0
  243. data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto +44 -0
  244. data/vendor/google.golang.org/appengine/internal/transaction.go +115 -0
  245. data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go +527 -0
  246. data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto +64 -0
  247. data/vendor/google.golang.org/appengine/urlfetch/urlfetch.go +210 -0
  248. data/vendor/google.golang.org/protobuf/AUTHORS +3 -0
  249. data/vendor/google.golang.org/protobuf/CONTRIBUTORS +3 -0
  250. data/vendor/google.golang.org/protobuf/LICENSE +27 -0
  251. data/vendor/google.golang.org/protobuf/PATENTS +22 -0
  252. data/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +773 -0
  253. data/vendor/google.golang.org/protobuf/encoding/prototext/doc.go +7 -0
  254. data/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +371 -0
  255. data/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +538 -0
  256. data/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +318 -0
  257. data/vendor/google.golang.org/protobuf/internal/descopts/options.go +29 -0
  258. data/vendor/google.golang.org/protobuf/internal/detrand/rand.go +69 -0
  259. data/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go +213 -0
  260. data/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go +241 -0
  261. data/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +207 -0
  262. data/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +665 -0
  263. data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go +190 -0
  264. data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go +161 -0
  265. data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go +373 -0
  266. data/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go +29 -0
  267. data/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go +265 -0
  268. data/vendor/google.golang.org/protobuf/internal/errors/errors.go +89 -0
  269. data/vendor/google.golang.org/protobuf/internal/errors/is_go112.go +39 -0
  270. data/vendor/google.golang.org/protobuf/internal/errors/is_go113.go +12 -0
  271. data/vendor/google.golang.org/protobuf/internal/filedesc/build.go +158 -0
  272. data/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +631 -0
  273. data/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +471 -0
  274. data/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +704 -0
  275. data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go +450 -0
  276. data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +356 -0
  277. data/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +107 -0
  278. data/vendor/google.golang.org/protobuf/internal/filetype/build.go +297 -0
  279. data/vendor/google.golang.org/protobuf/internal/flags/flags.go +24 -0
  280. data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go +9 -0
  281. data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go +9 -0
  282. data/vendor/google.golang.org/protobuf/internal/genid/any_gen.go +34 -0
  283. data/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +106 -0
  284. data/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +829 -0
  285. data/vendor/google.golang.org/protobuf/internal/genid/doc.go +11 -0
  286. data/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go +34 -0
  287. data/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go +19 -0
  288. data/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go +31 -0
  289. data/vendor/google.golang.org/protobuf/internal/genid/goname.go +25 -0
  290. data/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +16 -0
  291. data/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go +31 -0
  292. data/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go +116 -0
  293. data/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go +34 -0
  294. data/vendor/google.golang.org/protobuf/internal/genid/type_gen.go +184 -0
  295. data/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +13 -0
  296. data/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go +175 -0
  297. data/vendor/google.golang.org/protobuf/internal/impl/api_export.go +177 -0
  298. data/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +141 -0
  299. data/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +223 -0
  300. data/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +830 -0
  301. data/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +5637 -0
  302. data/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +388 -0
  303. data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go +37 -0
  304. data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go +11 -0
  305. data/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +217 -0
  306. data/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +123 -0
  307. data/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +209 -0
  308. data/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go +557 -0
  309. data/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +17 -0
  310. data/vendor/google.golang.org/protobuf/internal/impl/convert.go +496 -0
  311. data/vendor/google.golang.org/protobuf/internal/impl/convert_list.go +141 -0
  312. data/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +121 -0
  313. data/vendor/google.golang.org/protobuf/internal/impl/decode.go +276 -0
  314. data/vendor/google.golang.org/protobuf/internal/impl/encode.go +201 -0
  315. data/vendor/google.golang.org/protobuf/internal/impl/enum.go +21 -0
  316. data/vendor/google.golang.org/protobuf/internal/impl/extension.go +156 -0
  317. data/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +219 -0
  318. data/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go +92 -0
  319. data/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +176 -0
  320. data/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +81 -0
  321. data/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +558 -0
  322. data/vendor/google.golang.org/protobuf/internal/impl/merge.go +176 -0
  323. data/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go +209 -0
  324. data/vendor/google.golang.org/protobuf/internal/impl/message.go +276 -0
  325. data/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +465 -0
  326. data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +543 -0
  327. data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +249 -0
  328. data/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +178 -0
  329. data/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +174 -0
  330. data/vendor/google.golang.org/protobuf/internal/impl/validate.go +576 -0
  331. data/vendor/google.golang.org/protobuf/internal/impl/weak.go +74 -0
  332. data/vendor/google.golang.org/protobuf/internal/order/order.go +89 -0
  333. data/vendor/google.golang.org/protobuf/internal/order/range.go +115 -0
  334. data/vendor/google.golang.org/protobuf/internal/pragma/pragma.go +29 -0
  335. data/vendor/google.golang.org/protobuf/internal/set/ints.go +58 -0
  336. data/vendor/google.golang.org/protobuf/internal/strs/strings.go +196 -0
  337. data/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +27 -0
  338. data/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +94 -0
  339. data/vendor/google.golang.org/protobuf/internal/version/version.go +79 -0
  340. data/vendor/google.golang.org/protobuf/proto/checkinit.go +71 -0
  341. data/vendor/google.golang.org/protobuf/proto/decode.go +278 -0
  342. data/vendor/google.golang.org/protobuf/proto/decode_gen.go +603 -0
  343. data/vendor/google.golang.org/protobuf/proto/doc.go +94 -0
  344. data/vendor/google.golang.org/protobuf/proto/encode.go +319 -0
  345. data/vendor/google.golang.org/protobuf/proto/encode_gen.go +97 -0
  346. data/vendor/google.golang.org/protobuf/proto/equal.go +167 -0
  347. data/vendor/google.golang.org/protobuf/proto/extension.go +92 -0
  348. data/vendor/google.golang.org/protobuf/proto/merge.go +139 -0
  349. data/vendor/google.golang.org/protobuf/proto/messageset.go +93 -0
  350. data/vendor/google.golang.org/protobuf/proto/proto.go +43 -0
  351. data/vendor/google.golang.org/protobuf/proto/proto_methods.go +19 -0
  352. data/vendor/google.golang.org/protobuf/proto/proto_reflect.go +19 -0
  353. data/vendor/google.golang.org/protobuf/proto/reset.go +43 -0
  354. data/vendor/google.golang.org/protobuf/proto/size.go +97 -0
  355. data/vendor/google.golang.org/protobuf/proto/size_gen.go +55 -0
  356. data/vendor/google.golang.org/protobuf/proto/wrappers.go +29 -0
  357. data/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +276 -0
  358. data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +248 -0
  359. data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +286 -0
  360. data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +374 -0
  361. data/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +252 -0
  362. data/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +77 -0
  363. data/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +504 -0
  364. data/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go +128 -0
  365. data/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +461 -0
  366. data/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +665 -0
  367. data/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +285 -0
  368. data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +59 -0
  369. data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +411 -0
  370. data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go +98 -0
  371. data/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +869 -0
  372. data/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go +15 -0
  373. data/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +167 -0
  374. data/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go +44 -0
  375. data/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go +56 -0
  376. data/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +4039 -0
  377. data/vendor/modules.txt +79 -0
  378. metadata +495 -0
@@ -0,0 +1,77 @@
1
+ // Copyright 2020 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ package protoreflect
6
+
7
+ import (
8
+ "google.golang.org/protobuf/internal/pragma"
9
+ )
10
+
11
+ // The following types are used by the fast-path Message.ProtoMethods method.
12
+ //
13
+ // To avoid polluting the public protoreflect API with types used only by
14
+ // low-level implementations, the canonical definitions of these types are
15
+ // in the runtime/protoiface package. The definitions here and in protoiface
16
+ // must be kept in sync.
17
+ type (
18
+ methods = struct {
19
+ pragma.NoUnkeyedLiterals
20
+ Flags supportFlags
21
+ Size func(sizeInput) sizeOutput
22
+ Marshal func(marshalInput) (marshalOutput, error)
23
+ Unmarshal func(unmarshalInput) (unmarshalOutput, error)
24
+ Merge func(mergeInput) mergeOutput
25
+ CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)
26
+ }
27
+ supportFlags = uint64
28
+ sizeInput = struct {
29
+ pragma.NoUnkeyedLiterals
30
+ Message Message
31
+ Flags uint8
32
+ }
33
+ sizeOutput = struct {
34
+ pragma.NoUnkeyedLiterals
35
+ Size int
36
+ }
37
+ marshalInput = struct {
38
+ pragma.NoUnkeyedLiterals
39
+ Message Message
40
+ Buf []byte
41
+ Flags uint8
42
+ }
43
+ marshalOutput = struct {
44
+ pragma.NoUnkeyedLiterals
45
+ Buf []byte
46
+ }
47
+ unmarshalInput = struct {
48
+ pragma.NoUnkeyedLiterals
49
+ Message Message
50
+ Buf []byte
51
+ Flags uint8
52
+ Resolver interface {
53
+ FindExtensionByName(field FullName) (ExtensionType, error)
54
+ FindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)
55
+ }
56
+ }
57
+ unmarshalOutput = struct {
58
+ pragma.NoUnkeyedLiterals
59
+ Flags uint8
60
+ }
61
+ mergeInput = struct {
62
+ pragma.NoUnkeyedLiterals
63
+ Source Message
64
+ Destination Message
65
+ }
66
+ mergeOutput = struct {
67
+ pragma.NoUnkeyedLiterals
68
+ Flags uint8
69
+ }
70
+ checkInitializedInput = struct {
71
+ pragma.NoUnkeyedLiterals
72
+ Message Message
73
+ }
74
+ checkInitializedOutput = struct {
75
+ pragma.NoUnkeyedLiterals
76
+ }
77
+ )
@@ -0,0 +1,504 @@
1
+ // Copyright 2018 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // Package protoreflect provides interfaces to dynamically manipulate messages.
6
+ //
7
+ // This package includes type descriptors which describe the structure of types
8
+ // defined in proto source files and value interfaces which provide the
9
+ // ability to examine and manipulate the contents of messages.
10
+ //
11
+ //
12
+ // Protocol Buffer Descriptors
13
+ //
14
+ // Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor)
15
+ // are immutable objects that represent protobuf type information.
16
+ // They are wrappers around the messages declared in descriptor.proto.
17
+ // Protobuf descriptors alone lack any information regarding Go types.
18
+ //
19
+ // Enums and messages generated by this module implement Enum and ProtoMessage,
20
+ // where the Descriptor and ProtoReflect.Descriptor accessors respectively
21
+ // return the protobuf descriptor for the values.
22
+ //
23
+ // The protobuf descriptor interfaces are not meant to be implemented by
24
+ // user code since they might need to be extended in the future to support
25
+ // additions to the protobuf language.
26
+ // The "google.golang.org/protobuf/reflect/protodesc" package converts between
27
+ // google.protobuf.DescriptorProto messages and protobuf descriptors.
28
+ //
29
+ //
30
+ // Go Type Descriptors
31
+ //
32
+ // A type descriptor (e.g., EnumType or MessageType) is a constructor for
33
+ // a concrete Go type that represents the associated protobuf descriptor.
34
+ // There is commonly a one-to-one relationship between protobuf descriptors and
35
+ // Go type descriptors, but it can potentially be a one-to-many relationship.
36
+ //
37
+ // Enums and messages generated by this module implement Enum and ProtoMessage,
38
+ // where the Type and ProtoReflect.Type accessors respectively
39
+ // return the protobuf descriptor for the values.
40
+ //
41
+ // The "google.golang.org/protobuf/types/dynamicpb" package can be used to
42
+ // create Go type descriptors from protobuf descriptors.
43
+ //
44
+ //
45
+ // Value Interfaces
46
+ //
47
+ // The Enum and Message interfaces provide a reflective view over an
48
+ // enum or message instance. For enums, it provides the ability to retrieve
49
+ // the enum value number for any concrete enum type. For messages, it provides
50
+ // the ability to access or manipulate fields of the message.
51
+ //
52
+ // To convert a proto.Message to a protoreflect.Message, use the
53
+ // former's ProtoReflect method. Since the ProtoReflect method is new to the
54
+ // v2 message interface, it may not be present on older message implementations.
55
+ // The "github.com/golang/protobuf/proto".MessageReflect function can be used
56
+ // to obtain a reflective view on older messages.
57
+ //
58
+ //
59
+ // Relationships
60
+ //
61
+ // The following diagrams demonstrate the relationships between
62
+ // various types declared in this package.
63
+ //
64
+ //
65
+ // ┌───────────────────────────────────┐
66
+ // V │
67
+ // ┌────────────── New(n) ─────────────┐ │
68
+ // │ │ │
69
+ // │ ┌──── Descriptor() ──┐ │ ┌── Number() ──┐ │
70
+ // │ │ V V │ V │
71
+ // ╔════════════╗ ╔════════════════╗ ╔════════╗ ╔════════════╗
72
+ // ║ EnumType ║ ║ EnumDescriptor ║ ║ Enum ║ ║ EnumNumber ║
73
+ // ╚════════════╝ ╚════════════════╝ ╚════════╝ ╚════════════╝
74
+ // Λ Λ │ │
75
+ // │ └─── Descriptor() ──┘ │
76
+ // │ │
77
+ // └────────────────── Type() ───────┘
78
+ //
79
+ // • An EnumType describes a concrete Go enum type.
80
+ // It has an EnumDescriptor and can construct an Enum instance.
81
+ //
82
+ // • An EnumDescriptor describes an abstract protobuf enum type.
83
+ //
84
+ // • An Enum is a concrete enum instance. Generated enums implement Enum.
85
+ //
86
+ //
87
+ // ┌──────────────── New() ─────────────────┐
88
+ // │ │
89
+ // │ ┌─── Descriptor() ─────┐ │ ┌── Interface() ───┐
90
+ // │ │ V V │ V
91
+ // ╔═════════════╗ ╔═══════════════════╗ ╔═════════╗ ╔══════════════╗
92
+ // ║ MessageType ║ ║ MessageDescriptor ║ ║ Message ║ ║ ProtoMessage ║
93
+ // ╚═════════════╝ ╚═══════════════════╝ ╚═════════╝ ╚══════════════╝
94
+ // Λ Λ │ │ Λ │
95
+ // │ └──── Descriptor() ────┘ │ └─ ProtoReflect() ─┘
96
+ // │ │
97
+ // └─────────────────── Type() ─────────┘
98
+ //
99
+ // • A MessageType describes a concrete Go message type.
100
+ // It has a MessageDescriptor and can construct a Message instance.
101
+ //
102
+ // • A MessageDescriptor describes an abstract protobuf message type.
103
+ //
104
+ // • A Message is a concrete message instance. Generated messages implement
105
+ // ProtoMessage, which can convert to/from a Message.
106
+ //
107
+ //
108
+ // ┌── TypeDescriptor() ──┐ ┌───── Descriptor() ─────┐
109
+ // │ V │ V
110
+ // ╔═══════════════╗ ╔═════════════════════════╗ ╔═════════════════════╗
111
+ // ║ ExtensionType ║ ║ ExtensionTypeDescriptor ║ ║ ExtensionDescriptor ║
112
+ // ╚═══════════════╝ ╚═════════════════════════╝ ╚═════════════════════╝
113
+ // Λ │ │ Λ │ Λ
114
+ // └─────── Type() ───────┘ │ └─── may implement ────┘ │
115
+ // │ │
116
+ // └────── implements ────────┘
117
+ //
118
+ // • An ExtensionType describes a concrete Go implementation of an extension.
119
+ // It has an ExtensionTypeDescriptor and can convert to/from
120
+ // abstract Values and Go values.
121
+ //
122
+ // • An ExtensionTypeDescriptor is an ExtensionDescriptor
123
+ // which also has an ExtensionType.
124
+ //
125
+ // • An ExtensionDescriptor describes an abstract protobuf extension field and
126
+ // may not always be an ExtensionTypeDescriptor.
127
+ package protoreflect
128
+
129
+ import (
130
+ "fmt"
131
+ "strings"
132
+
133
+ "google.golang.org/protobuf/encoding/protowire"
134
+ "google.golang.org/protobuf/internal/pragma"
135
+ )
136
+
137
+ type doNotImplement pragma.DoNotImplement
138
+
139
+ // ProtoMessage is the top-level interface that all proto messages implement.
140
+ // This is declared in the protoreflect package to avoid a cyclic dependency;
141
+ // use the proto.Message type instead, which aliases this type.
142
+ type ProtoMessage interface{ ProtoReflect() Message }
143
+
144
+ // Syntax is the language version of the proto file.
145
+ type Syntax syntax
146
+
147
+ type syntax int8 // keep exact type opaque as the int type may change
148
+
149
+ const (
150
+ Proto2 Syntax = 2
151
+ Proto3 Syntax = 3
152
+ )
153
+
154
+ // IsValid reports whether the syntax is valid.
155
+ func (s Syntax) IsValid() bool {
156
+ switch s {
157
+ case Proto2, Proto3:
158
+ return true
159
+ default:
160
+ return false
161
+ }
162
+ }
163
+
164
+ // String returns s as a proto source identifier (e.g., "proto2").
165
+ func (s Syntax) String() string {
166
+ switch s {
167
+ case Proto2:
168
+ return "proto2"
169
+ case Proto3:
170
+ return "proto3"
171
+ default:
172
+ return fmt.Sprintf("<unknown:%d>", s)
173
+ }
174
+ }
175
+
176
+ // GoString returns s as a Go source identifier (e.g., "Proto2").
177
+ func (s Syntax) GoString() string {
178
+ switch s {
179
+ case Proto2:
180
+ return "Proto2"
181
+ case Proto3:
182
+ return "Proto3"
183
+ default:
184
+ return fmt.Sprintf("Syntax(%d)", s)
185
+ }
186
+ }
187
+
188
+ // Cardinality determines whether a field is optional, required, or repeated.
189
+ type Cardinality cardinality
190
+
191
+ type cardinality int8 // keep exact type opaque as the int type may change
192
+
193
+ // Constants as defined by the google.protobuf.Cardinality enumeration.
194
+ const (
195
+ Optional Cardinality = 1 // appears zero or one times
196
+ Required Cardinality = 2 // appears exactly one time; invalid with Proto3
197
+ Repeated Cardinality = 3 // appears zero or more times
198
+ )
199
+
200
+ // IsValid reports whether the cardinality is valid.
201
+ func (c Cardinality) IsValid() bool {
202
+ switch c {
203
+ case Optional, Required, Repeated:
204
+ return true
205
+ default:
206
+ return false
207
+ }
208
+ }
209
+
210
+ // String returns c as a proto source identifier (e.g., "optional").
211
+ func (c Cardinality) String() string {
212
+ switch c {
213
+ case Optional:
214
+ return "optional"
215
+ case Required:
216
+ return "required"
217
+ case Repeated:
218
+ return "repeated"
219
+ default:
220
+ return fmt.Sprintf("<unknown:%d>", c)
221
+ }
222
+ }
223
+
224
+ // GoString returns c as a Go source identifier (e.g., "Optional").
225
+ func (c Cardinality) GoString() string {
226
+ switch c {
227
+ case Optional:
228
+ return "Optional"
229
+ case Required:
230
+ return "Required"
231
+ case Repeated:
232
+ return "Repeated"
233
+ default:
234
+ return fmt.Sprintf("Cardinality(%d)", c)
235
+ }
236
+ }
237
+
238
+ // Kind indicates the basic proto kind of a field.
239
+ type Kind kind
240
+
241
+ type kind int8 // keep exact type opaque as the int type may change
242
+
243
+ // Constants as defined by the google.protobuf.Field.Kind enumeration.
244
+ const (
245
+ BoolKind Kind = 8
246
+ EnumKind Kind = 14
247
+ Int32Kind Kind = 5
248
+ Sint32Kind Kind = 17
249
+ Uint32Kind Kind = 13
250
+ Int64Kind Kind = 3
251
+ Sint64Kind Kind = 18
252
+ Uint64Kind Kind = 4
253
+ Sfixed32Kind Kind = 15
254
+ Fixed32Kind Kind = 7
255
+ FloatKind Kind = 2
256
+ Sfixed64Kind Kind = 16
257
+ Fixed64Kind Kind = 6
258
+ DoubleKind Kind = 1
259
+ StringKind Kind = 9
260
+ BytesKind Kind = 12
261
+ MessageKind Kind = 11
262
+ GroupKind Kind = 10
263
+ )
264
+
265
+ // IsValid reports whether the kind is valid.
266
+ func (k Kind) IsValid() bool {
267
+ switch k {
268
+ case BoolKind, EnumKind,
269
+ Int32Kind, Sint32Kind, Uint32Kind,
270
+ Int64Kind, Sint64Kind, Uint64Kind,
271
+ Sfixed32Kind, Fixed32Kind, FloatKind,
272
+ Sfixed64Kind, Fixed64Kind, DoubleKind,
273
+ StringKind, BytesKind, MessageKind, GroupKind:
274
+ return true
275
+ default:
276
+ return false
277
+ }
278
+ }
279
+
280
+ // String returns k as a proto source identifier (e.g., "bool").
281
+ func (k Kind) String() string {
282
+ switch k {
283
+ case BoolKind:
284
+ return "bool"
285
+ case EnumKind:
286
+ return "enum"
287
+ case Int32Kind:
288
+ return "int32"
289
+ case Sint32Kind:
290
+ return "sint32"
291
+ case Uint32Kind:
292
+ return "uint32"
293
+ case Int64Kind:
294
+ return "int64"
295
+ case Sint64Kind:
296
+ return "sint64"
297
+ case Uint64Kind:
298
+ return "uint64"
299
+ case Sfixed32Kind:
300
+ return "sfixed32"
301
+ case Fixed32Kind:
302
+ return "fixed32"
303
+ case FloatKind:
304
+ return "float"
305
+ case Sfixed64Kind:
306
+ return "sfixed64"
307
+ case Fixed64Kind:
308
+ return "fixed64"
309
+ case DoubleKind:
310
+ return "double"
311
+ case StringKind:
312
+ return "string"
313
+ case BytesKind:
314
+ return "bytes"
315
+ case MessageKind:
316
+ return "message"
317
+ case GroupKind:
318
+ return "group"
319
+ default:
320
+ return fmt.Sprintf("<unknown:%d>", k)
321
+ }
322
+ }
323
+
324
+ // GoString returns k as a Go source identifier (e.g., "BoolKind").
325
+ func (k Kind) GoString() string {
326
+ switch k {
327
+ case BoolKind:
328
+ return "BoolKind"
329
+ case EnumKind:
330
+ return "EnumKind"
331
+ case Int32Kind:
332
+ return "Int32Kind"
333
+ case Sint32Kind:
334
+ return "Sint32Kind"
335
+ case Uint32Kind:
336
+ return "Uint32Kind"
337
+ case Int64Kind:
338
+ return "Int64Kind"
339
+ case Sint64Kind:
340
+ return "Sint64Kind"
341
+ case Uint64Kind:
342
+ return "Uint64Kind"
343
+ case Sfixed32Kind:
344
+ return "Sfixed32Kind"
345
+ case Fixed32Kind:
346
+ return "Fixed32Kind"
347
+ case FloatKind:
348
+ return "FloatKind"
349
+ case Sfixed64Kind:
350
+ return "Sfixed64Kind"
351
+ case Fixed64Kind:
352
+ return "Fixed64Kind"
353
+ case DoubleKind:
354
+ return "DoubleKind"
355
+ case StringKind:
356
+ return "StringKind"
357
+ case BytesKind:
358
+ return "BytesKind"
359
+ case MessageKind:
360
+ return "MessageKind"
361
+ case GroupKind:
362
+ return "GroupKind"
363
+ default:
364
+ return fmt.Sprintf("Kind(%d)", k)
365
+ }
366
+ }
367
+
368
+ // FieldNumber is the field number in a message.
369
+ type FieldNumber = protowire.Number
370
+
371
+ // FieldNumbers represent a list of field numbers.
372
+ type FieldNumbers interface {
373
+ // Len reports the number of fields in the list.
374
+ Len() int
375
+ // Get returns the ith field number. It panics if out of bounds.
376
+ Get(i int) FieldNumber
377
+ // Has reports whether n is within the list of fields.
378
+ Has(n FieldNumber) bool
379
+
380
+ doNotImplement
381
+ }
382
+
383
+ // FieldRanges represent a list of field number ranges.
384
+ type FieldRanges interface {
385
+ // Len reports the number of ranges in the list.
386
+ Len() int
387
+ // Get returns the ith range. It panics if out of bounds.
388
+ Get(i int) [2]FieldNumber // start inclusive; end exclusive
389
+ // Has reports whether n is within any of the ranges.
390
+ Has(n FieldNumber) bool
391
+
392
+ doNotImplement
393
+ }
394
+
395
+ // EnumNumber is the numeric value for an enum.
396
+ type EnumNumber int32
397
+
398
+ // EnumRanges represent a list of enum number ranges.
399
+ type EnumRanges interface {
400
+ // Len reports the number of ranges in the list.
401
+ Len() int
402
+ // Get returns the ith range. It panics if out of bounds.
403
+ Get(i int) [2]EnumNumber // start inclusive; end inclusive
404
+ // Has reports whether n is within any of the ranges.
405
+ Has(n EnumNumber) bool
406
+
407
+ doNotImplement
408
+ }
409
+
410
+ // Name is the short name for a proto declaration. This is not the name
411
+ // as used in Go source code, which might not be identical to the proto name.
412
+ type Name string // e.g., "Kind"
413
+
414
+ // IsValid reports whether s is a syntactically valid name.
415
+ // An empty name is invalid.
416
+ func (s Name) IsValid() bool {
417
+ return consumeIdent(string(s)) == len(s)
418
+ }
419
+
420
+ // Names represent a list of names.
421
+ type Names interface {
422
+ // Len reports the number of names in the list.
423
+ Len() int
424
+ // Get returns the ith name. It panics if out of bounds.
425
+ Get(i int) Name
426
+ // Has reports whether s matches any names in the list.
427
+ Has(s Name) bool
428
+
429
+ doNotImplement
430
+ }
431
+
432
+ // FullName is a qualified name that uniquely identifies a proto declaration.
433
+ // A qualified name is the concatenation of the proto package along with the
434
+ // fully-declared name (i.e., name of parent preceding the name of the child),
435
+ // with a '.' delimiter placed between each Name.
436
+ //
437
+ // This should not have any leading or trailing dots.
438
+ type FullName string // e.g., "google.protobuf.Field.Kind"
439
+
440
+ // IsValid reports whether s is a syntactically valid full name.
441
+ // An empty full name is invalid.
442
+ func (s FullName) IsValid() bool {
443
+ i := consumeIdent(string(s))
444
+ if i < 0 {
445
+ return false
446
+ }
447
+ for len(s) > i {
448
+ if s[i] != '.' {
449
+ return false
450
+ }
451
+ i++
452
+ n := consumeIdent(string(s[i:]))
453
+ if n < 0 {
454
+ return false
455
+ }
456
+ i += n
457
+ }
458
+ return true
459
+ }
460
+
461
+ func consumeIdent(s string) (i int) {
462
+ if len(s) == 0 || !isLetter(s[i]) {
463
+ return -1
464
+ }
465
+ i++
466
+ for len(s) > i && isLetterDigit(s[i]) {
467
+ i++
468
+ }
469
+ return i
470
+ }
471
+ func isLetter(c byte) bool {
472
+ return c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
473
+ }
474
+ func isLetterDigit(c byte) bool {
475
+ return isLetter(c) || ('0' <= c && c <= '9')
476
+ }
477
+
478
+ // Name returns the short name, which is the last identifier segment.
479
+ // A single segment FullName is the Name itself.
480
+ func (n FullName) Name() Name {
481
+ if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
482
+ return Name(n[i+1:])
483
+ }
484
+ return Name(n)
485
+ }
486
+
487
+ // Parent returns the full name with the trailing identifier removed.
488
+ // A single segment FullName has no parent.
489
+ func (n FullName) Parent() FullName {
490
+ if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
491
+ return n[:i]
492
+ }
493
+ return ""
494
+ }
495
+
496
+ // Append returns the qualified name appended with the provided short name.
497
+ //
498
+ // Invariant: n == n.Parent().Append(n.Name()) // assuming n is valid
499
+ func (n FullName) Append(s Name) FullName {
500
+ if n == "" {
501
+ return FullName(s)
502
+ }
503
+ return n + "." + FullName(s)
504
+ }