document.proto 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.firestore.v1beta1;
  16. import "google/protobuf/struct.proto";
  17. import "google/protobuf/timestamp.proto";
  18. import "google/type/latlng.proto";
  19. option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
  20. option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "DocumentProto";
  23. option java_package = "com.google.firestore.v1beta1";
  24. option objc_class_prefix = "GCFS";
  25. option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
  26. option ruby_package = "Google::Cloud::Firestore::V1beta1";
  27. // A Firestore document.
  28. //
  29. // Must not exceed 1 MiB - 4 bytes.
  30. message Document {
  31. // The resource name of the document, for example
  32. // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  33. string name = 1;
  34. // The document's fields.
  35. //
  36. // The map keys represent field names.
  37. //
  38. // A simple field name contains only characters `a` to `z`, `A` to `Z`,
  39. // `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
  40. // `foo_bar_17`.
  41. //
  42. // Field names matching the regular expression `__.*__` are reserved. Reserved
  43. // field names are forbidden except in certain documented contexts. The map
  44. // keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
  45. // empty.
  46. //
  47. // Field paths may be used in other contexts to refer to structured fields
  48. // defined here. For `map_value`, the field path is represented by the simple
  49. // or quoted field names of the containing fields, delimited by `.`. For
  50. // example, the structured field
  51. // `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
  52. // represented by the field path `foo.x&y`.
  53. //
  54. // Within a field path, a quoted field name starts and ends with `` ` `` and
  55. // may contain any character. Some characters, including `` ` ``, must be
  56. // escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
  57. // `` `bak\`tik` `` represents `` bak`tik ``.
  58. map<string, Value> fields = 2;
  59. // Output only. The time at which the document was created.
  60. //
  61. // This value increases monotonically when a document is deleted then
  62. // recreated. It can also be compared to values from other documents and
  63. // the `read_time` of a query.
  64. google.protobuf.Timestamp create_time = 3;
  65. // Output only. The time at which the document was last changed.
  66. //
  67. // This value is initially set to the `create_time` then increases
  68. // monotonically with each change to the document. It can also be
  69. // compared to values from other documents and the `read_time` of a query.
  70. google.protobuf.Timestamp update_time = 4;
  71. }
  72. // A message that can hold any of the supported value types.
  73. message Value {
  74. // Must have a value set.
  75. oneof value_type {
  76. // A null value.
  77. google.protobuf.NullValue null_value = 11;
  78. // A boolean value.
  79. bool boolean_value = 1;
  80. // An integer value.
  81. int64 integer_value = 2;
  82. // A double value.
  83. double double_value = 3;
  84. // A timestamp value.
  85. //
  86. // Precise only to microseconds. When stored, any additional precision is
  87. // rounded down.
  88. google.protobuf.Timestamp timestamp_value = 10;
  89. // A string value.
  90. //
  91. // The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
  92. // Only the first 1,500 bytes of the UTF-8 representation are considered by
  93. // queries.
  94. string string_value = 17;
  95. // A bytes value.
  96. //
  97. // Must not exceed 1 MiB - 89 bytes.
  98. // Only the first 1,500 bytes are considered by queries.
  99. bytes bytes_value = 18;
  100. // A reference to a document. For example:
  101. // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  102. string reference_value = 5;
  103. // A geo point value representing a point on the surface of Earth.
  104. google.type.LatLng geo_point_value = 8;
  105. // An array value.
  106. //
  107. // Cannot directly contain another array value, though can contain an
  108. // map which contains another array.
  109. ArrayValue array_value = 9;
  110. // A map value.
  111. MapValue map_value = 6;
  112. }
  113. }
  114. // An array value.
  115. message ArrayValue {
  116. // Values in the array.
  117. repeated Value values = 1;
  118. }
  119. // A map value.
  120. message MapValue {
  121. // The map's fields.
  122. //
  123. // The map keys represent field names. Field names matching the regular
  124. // expression `__.*__` are reserved. Reserved field names are forbidden except
  125. // in certain documented contexts. The map keys, represented as UTF-8, must
  126. // not exceed 1,500 bytes and cannot be empty.
  127. map<string, Value> fields = 1;
  128. }