blob: f153bcfea41445ac80542790f366e9077221fe17 [file] [log] [blame]
Joe Tsai4fddeba2019-03-20 18:29:32 -07001// Copyright 2018 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 protoiface contains types referenced by generated messages.
6//
7// WARNING: This package should only ever be imported by generated messages.
8// The compatibility agreement covers nothing except for functionality needed
9// to keep existing generated messages operational.
10package protoiface
11
12import (
13 "github.com/golang/protobuf/v2/reflect/protoreflect"
14)
15
16type MessageV1 interface {
17 Reset()
18 String() string
19 ProtoMessage()
20}
21
22type ExtensionRangeV1 struct {
23 Start, End int32 // both inclusive
24}
25
26type ExtensionDescV1 struct {
27 // Type is the descriptor type for the extension field using the v2 API.
28 // If populated, the information in this field takes precedence over
29 // all other fields in ExtensionDescV1.
30 Type protoreflect.ExtensionType
31
32 // ExtendedType is a typed nil-pointer to the parent message type that
33 // is being extended. It is possible for this to be unpopulated in v2
34 // since the message may no longer implement the MessageV1 interface.
35 //
36 // Deprecated: Use Type.ExtendedType instead.
37 ExtendedType MessageV1
38
39 // ExtensionType is zero value of the extension type.
40 //
41 // For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType
42 // may not be identical:
43 // * for scalars (except []byte), where ExtensionType uses *T,
44 // while Type.GoType uses T.
45 // * for repeated fields, where ExtensionType uses []T,
46 // while Type.GoType uses *[]T.
47 //
48 // Deprecated: Use Type.GoType instead.
49 ExtensionType interface{}
50
51 // Field is the field number of the extension.
52 //
53 // Deprecated: Use Type.Number instead.
54 Field int32 // field number
55
56 // Name is the fully qualified name of extension.
57 //
58 // Deprecated: Use Type.FullName instead.
59 Name string
60
61 // Tag is the protobuf struct tag used in the v1 API.
62 //
63 // Deprecated: Do not use.
64 Tag string
65
66 // Filename is the proto filename in which the extension is defined.
67 //
68 // Deprecated: Use Type.Parent to ascend to the top-most parent and use
69 // protoreflect.FileDescriptor.Path.
70 Filename string
71}