pb

package
v0.0.0-...-6a8978f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 5 Imported by: 0

README

编译文件

必须sample这个目录下执行

protoc -I=. --go_out=./pb --go_opt=module="gitee.com/go-course/go8/micro/rpc/protobuf/sample/pb" pb/enum.proto
protoc -I=. --go_out=./pb --go_opt=module="gitee.com/go-course/go8/micro/rpc/protobuf/sample/pb" pb/array.proto
protoc -I=. --go_out=./pb --go_opt=module="gitee.com/go-course/go8/micro/rpc/protobuf/sample/pb" pb/oneof.proto
protoc -I=. -I=/usr/local/include --go_out=./pb --go_opt=module="gitee.com/go-course/go8/micro/rpc/protobuf/sample/pb" pb/any.proto
protoc -I=. -I=/usr/local/include --go_out=./other_pb --go_opt=module="gitee.com/go-course/go8/micro/rpc/protobuf/sample/other_pb" other_pb/other.proto

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	STATUS_name = map[int32]string{
		0: "DRAFT",
		1: "PUBLISHED",
	}
	STATUS_value = map[string]int32{
		"DRAFT":     0,
		"PUBLISHED": 1,
	}
)

Enum value maps for STATUS.

View Source
var (
	TYPE_name = map[int32]string{
		0: "RESOURCE_CHANGE",
		1: "RESOURCE_ALERT",
	}
	TYPE_value = map[string]int32{
		"RESOURCE_CHANGE": 0,
		"RESOURCE_ALERT":  1,
	}
)

Enum value maps for TYPE.

View Source
var File_pb_any_proto protoreflect.FileDescriptor
View Source
var File_pb_array_proto protoreflect.FileDescriptor
View Source
var File_pb_enum_proto protoreflect.FileDescriptor
View Source
var File_pb_oneof_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Blog

type Blog struct {
	Title  string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"`
	//  tags: {"color": "red", "group": "test"} map[string]string
	Tags map[string]string `` /* 149-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Blog) Descriptor deprecated

func (*Blog) Descriptor() ([]byte, []int)

Deprecated: Use Blog.ProtoReflect.Descriptor instead.

func (*Blog) GetAuthor

func (x *Blog) GetAuthor() string

func (*Blog) GetTags

func (x *Blog) GetTags() map[string]string

func (*Blog) GetTitle

func (x *Blog) GetTitle() string

func (*Blog) ProtoMessage

func (*Blog) ProtoMessage()

func (*Blog) ProtoReflect

func (x *Blog) ProtoReflect() protoreflect.Message

func (*Blog) Reset

func (x *Blog) Reset()

func (*Blog) String

func (x *Blog) String() string

type BlogSet

type BlogSet struct {

	// optional 该值可选, 可以为nil, 因此必须是一个指针
	Total *int64 `protobuf:"varint,1,opt,name=total,proto3,oneof" json:"total,omitempty"`
	// repeated 表示定义数组
	// 嵌套message
	Items []*Blog `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

博客列表

func (*BlogSet) Descriptor deprecated

func (*BlogSet) Descriptor() ([]byte, []int)

Deprecated: Use BlogSet.ProtoReflect.Descriptor instead.

func (*BlogSet) GetItems

func (x *BlogSet) GetItems() []*Blog

func (*BlogSet) GetTotal

func (x *BlogSet) GetTotal() int64

func (*BlogSet) ProtoMessage

func (*BlogSet) ProtoMessage()

func (*BlogSet) ProtoReflect

func (x *BlogSet) ProtoReflect() protoreflect.Message

func (*BlogSet) Reset

func (x *BlogSet) Reset()

func (*BlogSet) String

func (x *BlogSet) String() string

type Device

type Device struct {

	// "a1", "a2", "xxxxx"
	DeviceType string `protobuf:"bytes,1,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"`
	// 设备具体的数据
	Data *anypb.Any `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

比如IOT设备上报的报文, 不同设备 上报的数据结构是不一样

func (*Device) Descriptor deprecated

func (*Device) Descriptor() ([]byte, []int)

Deprecated: Use Device.ProtoReflect.Descriptor instead.

func (*Device) GetData

func (x *Device) GetData() *anypb.Any

func (*Device) GetDeviceType

func (x *Device) GetDeviceType() string

func (*Device) ProtoMessage

func (*Device) ProtoMessage()

func (*Device) ProtoReflect

func (x *Device) ProtoReflect() protoreflect.Message

func (*Device) Reset

func (x *Device) Reset()

func (*Device) String

func (x *Device) String() string

type Event

type Event struct {
	Type TYPE `protobuf:"varint,1,opt,name=type,proto3,enum=hello.TYPE" json:"type,omitempty"`
	// Types that are assignable to Data:
	//	*Event_ResourceChange
	//	*Event_ResourceAlert
	Data isEvent_Data `protobuf_oneof:"data"`
	// contains filtered or unexported fields
}

func (*Event) Descriptor deprecated

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetData

func (m *Event) GetData() isEvent_Data

func (*Event) GetResourceAlert

func (x *Event) GetResourceAlert() *ResourceAlert

func (*Event) GetResourceChange

func (x *Event) GetResourceChange() *ResourceChange

func (*Event) GetType

func (x *Event) GetType() TYPE

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type Event_ResourceAlert

type Event_ResourceAlert struct {
	ResourceAlert *ResourceAlert `protobuf:"bytes,3,opt,name=resource_alert,json=resourceAlert,proto3,oneof"`
}

type Event_ResourceChange

type Event_ResourceChange struct {
	ResourceChange *ResourceChange `protobuf:"bytes,2,opt,name=resource_change,json=resourceChange,proto3,oneof"`
}

type ResourceAlert

type ResourceAlert struct {
	ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"`
	// info,warnning, danger
	Levle string `protobuf:"bytes,2,opt,name=levle,proto3" json:"levle,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceAlert) Descriptor deprecated

func (*ResourceAlert) Descriptor() ([]byte, []int)

Deprecated: Use ResourceAlert.ProtoReflect.Descriptor instead.

func (*ResourceAlert) GetLevle

func (x *ResourceAlert) GetLevle() string

func (*ResourceAlert) GetResourceId

func (x *ResourceAlert) GetResourceId() string

func (*ResourceAlert) ProtoMessage

func (*ResourceAlert) ProtoMessage()

func (*ResourceAlert) ProtoReflect

func (x *ResourceAlert) ProtoReflect() protoreflect.Message

func (*ResourceAlert) Reset

func (x *ResourceAlert) Reset()

func (*ResourceAlert) String

func (x *ResourceAlert) String() string

type ResourceChange

type ResourceChange struct {
	ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"`
	// create,delete
	Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceChange) Descriptor deprecated

func (*ResourceChange) Descriptor() ([]byte, []int)

Deprecated: Use ResourceChange.ProtoReflect.Descriptor instead.

func (*ResourceChange) GetAction

func (x *ResourceChange) GetAction() string

func (*ResourceChange) GetResourceId

func (x *ResourceChange) GetResourceId() string

func (*ResourceChange) ProtoMessage

func (*ResourceChange) ProtoMessage()

func (*ResourceChange) ProtoReflect

func (x *ResourceChange) ProtoReflect() protoreflect.Message

func (*ResourceChange) Reset

func (x *ResourceChange) Reset()

func (*ResourceChange) String

func (x *ResourceChange) String() string

type STATUS

type STATUS int32

定义文章只有下面几种状态

const (
	// 草稿状态
	STATUS_DRAFT STATUS = 0
	// 已发布
	STATUS_PUBLISHED STATUS = 1
)

func (STATUS) Descriptor

func (STATUS) Descriptor() protoreflect.EnumDescriptor

func (STATUS) Enum

func (x STATUS) Enum() *STATUS

func (STATUS) EnumDescriptor deprecated

func (STATUS) EnumDescriptor() ([]byte, []int)

Deprecated: Use STATUS.Descriptor instead.

func (STATUS) Number

func (x STATUS) Number() protoreflect.EnumNumber

func (STATUS) String

func (x STATUS) String() string

func (STATUS) Type

func (STATUS) Type() protoreflect.EnumType

type TYPE

type TYPE int32
const (
	TYPE_RESOURCE_CHANGE TYPE = 0
	TYPE_RESOURCE_ALERT  TYPE = 1
)

func (TYPE) Descriptor

func (TYPE) Descriptor() protoreflect.EnumDescriptor

func (TYPE) Enum

func (x TYPE) Enum() *TYPE

func (TYPE) EnumDescriptor deprecated

func (TYPE) EnumDescriptor() ([]byte, []int)

Deprecated: Use TYPE.Descriptor instead.

func (TYPE) Number

func (x TYPE) Number() protoreflect.EnumNumber

func (TYPE) String

func (x TYPE) String() string

func (TYPE) Type

func (TYPE) Type() protoreflect.EnumType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL