doc.go 3.1 KB

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