blob: 90edaf947cdb3b98316bd9a615ae5ce77dfd6a2f [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.
Joe Tsai0fc49f82019-05-01 12:29:25 -070030 //
31 // TODO: Delete this and make this whole struct implement ExtensionDescV1.
Joe Tsai4fddeba2019-03-20 18:29:32 -070032 Type protoreflect.ExtensionType
33
34 // ExtendedType is a typed nil-pointer to the parent message type that
35 // is being extended. It is possible for this to be unpopulated in v2
36 // since the message may no longer implement the MessageV1 interface.
37 //
38 // Deprecated: Use Type.ExtendedType instead.
39 ExtendedType MessageV1
40
41 // ExtensionType is zero value of the extension type.
42 //
43 // For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType
44 // may not be identical:
45 // * for scalars (except []byte), where ExtensionType uses *T,
46 // while Type.GoType uses T.
47 // * for repeated fields, where ExtensionType uses []T,
48 // while Type.GoType uses *[]T.
49 //
50 // Deprecated: Use Type.GoType instead.
51 ExtensionType interface{}
52
53 // Field is the field number of the extension.
54 //
55 // Deprecated: Use Type.Number instead.
Joe Tsaiebbb4bb2019-04-01 11:02:32 -070056 Field int32
Joe Tsai4fddeba2019-03-20 18:29:32 -070057
58 // Name is the fully qualified name of extension.
59 //
60 // Deprecated: Use Type.FullName instead.
61 Name string
62
63 // Tag is the protobuf struct tag used in the v1 API.
64 //
65 // Deprecated: Do not use.
66 Tag string
67
68 // Filename is the proto filename in which the extension is defined.
69 //
70 // Deprecated: Use Type.Parent to ascend to the top-most parent and use
71 // protoreflect.FileDescriptor.Path.
72 Filename string
73}