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