blob: 80ed16a0c295452592bea7bc8a22f2dc2ffc4b67 [file] [log] [blame]
khenaidoo26721882021-08-11 17:42:52 -04001// 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:
Abhay Kumar40252eb2025-10-13 13:25:53 +00008// https://protobuf.dev.
khenaidoo26721882021-08-11 17:42:52 -04009//
10// For a tutorial on using protocol buffers with Go, see:
Abhay Kumar40252eb2025-10-13 13:25:53 +000011// https://protobuf.dev/getting-started/gotutorial.
khenaidoo26721882021-08-11 17:42:52 -040012//
13// For a guide to generated Go protocol buffer code, see:
Abhay Kumar40252eb2025-10-13 13:25:53 +000014// https://protobuf.dev/reference/go/go-generated.
khenaidoo26721882021-08-11 17:42:52 -040015//
Abhay Kumar40252eb2025-10-13 13:25:53 +000016// # Binary serialization
khenaidoo26721882021-08-11 17:42:52 -040017//
18// This package contains functions to convert to and from the wire format,
19// an efficient binary serialization of protocol buffers.
20//
Abhay Kumar40252eb2025-10-13 13:25:53 +000021// - [Size] reports the size of a message in the wire format.
khenaidoo26721882021-08-11 17:42:52 -040022//
Abhay Kumar40252eb2025-10-13 13:25:53 +000023// - [Marshal] converts a message to the wire format.
24// The [MarshalOptions] type provides more control over wire marshaling.
khenaidoo26721882021-08-11 17:42:52 -040025//
Abhay Kumar40252eb2025-10-13 13:25:53 +000026// - [Unmarshal] converts a message from the wire format.
27// The [UnmarshalOptions] type provides more control over wire unmarshaling.
khenaidoo26721882021-08-11 17:42:52 -040028//
Abhay Kumar40252eb2025-10-13 13:25:53 +000029// # Basic message operations
khenaidoo26721882021-08-11 17:42:52 -040030//
Abhay Kumar40252eb2025-10-13 13:25:53 +000031// - [Clone] makes a deep copy of a message.
khenaidoo26721882021-08-11 17:42:52 -040032//
Abhay Kumar40252eb2025-10-13 13:25:53 +000033// - [Merge] merges the content of a message into another.
khenaidoo26721882021-08-11 17:42:52 -040034//
Abhay Kumar40252eb2025-10-13 13:25:53 +000035// - [Equal] compares two messages. For more control over comparisons
36// and detailed reporting of differences, see package
37// [google.golang.org/protobuf/testing/protocmp].
khenaidoo26721882021-08-11 17:42:52 -040038//
Abhay Kumar40252eb2025-10-13 13:25:53 +000039// - [Reset] clears the content of a message.
khenaidoo26721882021-08-11 17:42:52 -040040//
Abhay Kumar40252eb2025-10-13 13:25:53 +000041// - [CheckInitialized] reports whether all required fields in a message are set.
khenaidoo26721882021-08-11 17:42:52 -040042//
Abhay Kumar40252eb2025-10-13 13:25:53 +000043// # Optional scalar constructors
khenaidoo26721882021-08-11 17:42:52 -040044//
45// The API for some generated messages represents optional scalar fields
46// as pointers to a value. For example, an optional string field has the
47// Go type *string.
48//
Abhay Kumar40252eb2025-10-13 13:25:53 +000049// - [Bool], [Int32], [Int64], [Uint32], [Uint64], [Float32], [Float64], and [String]
50// take a value and return a pointer to a new instance of it,
51// to simplify construction of optional field values.
khenaidoo26721882021-08-11 17:42:52 -040052//
53// Generated enum types usually have an Enum method which performs the
54// same operation.
55//
56// Optional scalar fields are only supported in proto2.
57//
Abhay Kumar40252eb2025-10-13 13:25:53 +000058// # Extension accessors
khenaidoo26721882021-08-11 17:42:52 -040059//
Abhay Kumar40252eb2025-10-13 13:25:53 +000060// - [HasExtension], [GetExtension], [SetExtension], and [ClearExtension]
61// access extension field values in a protocol buffer message.
khenaidoo26721882021-08-11 17:42:52 -040062//
63// Extension fields are only supported in proto2.
64//
Abhay Kumar40252eb2025-10-13 13:25:53 +000065// # Related packages
khenaidoo26721882021-08-11 17:42:52 -040066//
Abhay Kumar40252eb2025-10-13 13:25:53 +000067// - Package [google.golang.org/protobuf/encoding/protojson] converts messages to
68// and from JSON.
khenaidoo26721882021-08-11 17:42:52 -040069//
Abhay Kumar40252eb2025-10-13 13:25:53 +000070// - Package [google.golang.org/protobuf/encoding/prototext] converts messages to
71// and from the text format.
khenaidoo26721882021-08-11 17:42:52 -040072//
Abhay Kumar40252eb2025-10-13 13:25:53 +000073// - Package [google.golang.org/protobuf/reflect/protoreflect] provides a
74// reflection interface for protocol buffer data types.
khenaidoo26721882021-08-11 17:42:52 -040075//
Abhay Kumar40252eb2025-10-13 13:25:53 +000076// - Package [google.golang.org/protobuf/testing/protocmp] provides features
77// to compare protocol buffer messages with the [github.com/google/go-cmp/cmp]
78// package.
khenaidoo26721882021-08-11 17:42:52 -040079//
Abhay Kumar40252eb2025-10-13 13:25:53 +000080// - Package [google.golang.org/protobuf/types/dynamicpb] provides a dynamic
81// message type, suitable for working with messages where the protocol buffer
82// type is only known at runtime.
khenaidoo26721882021-08-11 17:42:52 -040083//
84// This module contains additional packages for more specialized use cases.
85// Consult the individual package documentation for details.
86package proto