You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

90 lines
3.2 KiB

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