blob: 56f3e788dac37bf93513acfcb94e727486fb0601 [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
Joe Tsai4fddeba2019-03-20 18:29:32 -07005package protoiface
6
7import (
Damien Neile89e6242019-05-13 23:55:40 -07008 "google.golang.org/protobuf/reflect/protoreflect"
Joe Tsai4fddeba2019-03-20 18:29:32 -07009)
10
11type MessageV1 interface {
12 Reset()
13 String() string
14 ProtoMessage()
15}
16
17type ExtensionRangeV1 struct {
18 Start, End int32 // both inclusive
19}
20
21type ExtensionDescV1 struct {
22 // Type is the descriptor type for the extension field using the v2 API.
23 // If populated, the information in this field takes precedence over
24 // all other fields in ExtensionDescV1.
Joe Tsai0fc49f82019-05-01 12:29:25 -070025 //
26 // TODO: Delete this and make this whole struct implement ExtensionDescV1.
Joe Tsai4fddeba2019-03-20 18:29:32 -070027 Type protoreflect.ExtensionType
28
29 // ExtendedType is a typed nil-pointer to the parent message type that
30 // is being extended. It is possible for this to be unpopulated in v2
31 // since the message may no longer implement the MessageV1 interface.
32 //
33 // Deprecated: Use Type.ExtendedType instead.
34 ExtendedType MessageV1
35
36 // ExtensionType is zero value of the extension type.
37 //
38 // For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType
39 // may not be identical:
40 // * for scalars (except []byte), where ExtensionType uses *T,
41 // while Type.GoType uses T.
42 // * for repeated fields, where ExtensionType uses []T,
43 // while Type.GoType uses *[]T.
44 //
45 // Deprecated: Use Type.GoType instead.
46 ExtensionType interface{}
47
48 // Field is the field number of the extension.
49 //
50 // Deprecated: Use Type.Number instead.
Joe Tsaiebbb4bb2019-04-01 11:02:32 -070051 Field int32
Joe Tsai4fddeba2019-03-20 18:29:32 -070052
53 // Name is the fully qualified name of extension.
54 //
55 // Deprecated: Use Type.FullName instead.
56 Name string
57
58 // Tag is the protobuf struct tag used in the v1 API.
59 //
60 // Deprecated: Do not use.
61 Tag string
62
63 // Filename is the proto filename in which the extension is defined.
64 //
65 // Deprecated: Use Type.Parent to ascend to the top-most parent and use
66 // protoreflect.FileDescriptor.Path.
67 Filename string
68}