doc.go 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright 2019 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. // Package proto provides functions operating on protocol buffer messages.
  5. //
  6. // For documentation on protocol buffers in general, see:
  7. //
  8. // https://developers.google.com/protocol-buffers
  9. //
  10. // For a tutorial on using protocol buffers with Go, see:
  11. //
  12. // https://developers.google.com/protocol-buffers/docs/gotutorial
  13. //
  14. // For a guide to generated Go protocol buffer code, see:
  15. //
  16. // https://developers.google.com/protocol-buffers/docs/reference/go-generated
  17. //
  18. //
  19. // Binary serialization
  20. //
  21. // This package contains functions to convert to and from the wire format,
  22. // an efficient binary serialization of protocol buffers.
  23. //
  24. // • Size reports the size of a message in the wire format.
  25. //
  26. // • Marshal converts a message to the wire format.
  27. // The MarshalOptions type provides more control over wire marshaling.
  28. //
  29. // • Unmarshal converts a message from the wire format.
  30. // The UnmarshalOptions type provides more control over wire unmarshaling.
  31. //
  32. //
  33. // Basic message operations
  34. //
  35. // • Clone makes a deep copy of a message.
  36. //
  37. // • Merge merges the content of a message into another.
  38. //
  39. // • Equal compares two messages. For more control over comparisons
  40. // and detailed reporting of differences, see package
  41. // "google.golang.org/protobuf/testing/protocmp".
  42. //
  43. // • Reset clears the content of a message.
  44. //
  45. // • CheckInitialized reports whether all required fields in a message are set.
  46. //
  47. //
  48. // Optional scalar constructors
  49. //
  50. // The API for some generated messages represents optional scalar fields
  51. // as pointers to a value. For example, an optional string field has the
  52. // Go type *string.
  53. //
  54. // • Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String
  55. // take a value and return a pointer to a new instance of it,
  56. // to simplify construction of optional field values.
  57. //
  58. // Generated enum types usually have an Enum method which performs the
  59. // same operation.
  60. //
  61. // Optional scalar fields are only supported in proto2.
  62. //
  63. //
  64. // Extension accessors
  65. //
  66. // • HasExtension, GetExtension, SetExtension, and ClearExtension
  67. // access extension field values in a protocol buffer message.
  68. //
  69. // Extension fields are only supported in proto2.
  70. //
  71. //
  72. // Related packages
  73. //
  74. // • Package "google.golang.org/protobuf/encoding/protojson" converts messages to
  75. // and from JSON.
  76. //
  77. // • Package "google.golang.org/protobuf/encoding/prototext" converts messages to
  78. // and from the text format.
  79. //
  80. // • Package "google.golang.org/protobuf/reflect/protoreflect" provides a
  81. // reflection interface for protocol buffer data types.
  82. //
  83. // • Package "google.golang.org/protobuf/testing/protocmp" provides features
  84. // to compare protocol buffer messages with the "github.com/google/go-cmp/cmp"
  85. // package.
  86. //
  87. // • Package "google.golang.org/protobuf/types/dynamicpb" provides a dynamic
  88. // message type, suitable for working with messages where the protocol buffer
  89. // type is only known at runtime.
  90. //
  91. // This module contains additional packages for more specialized use cases.
  92. // Consult the individual package documentation for details.
  93. package proto