v1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_miniblog_v1_miniblog_proto protoreflect.FileDescriptor
View Source
var MiniBlog_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v1.MiniBlog",
	HandlerType: (*MiniBlogServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListUser",
			Handler:    _MiniBlog_ListUser_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "miniblog/v1/miniblog.proto",
}

MiniBlog_ServiceDesc is the grpc.ServiceDesc for MiniBlog service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterMiniBlogServer

func RegisterMiniBlogServer(s grpc.ServiceRegistrar, srv MiniBlogServer)

Types

type ListUserRequest

type ListUserRequest struct {
	Limit  int64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
	Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

ListUserRequest 指定了 `ListUser` 接口的请求参数,相当于 HTTP Request 并对每个属性都定义数据类型. 需要为每个属性分配一个唯一编号,称为标记。此标记由 protobuf 用于表示属性,而不是使用属性名称. 因此,在 JSON 中我们每次都需要传递属性名称 name,而 protobuf 将使用数字 1 来表示 name.

func (*ListUserRequest) Descriptor deprecated

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

Deprecated: Use ListUserRequest.ProtoReflect.Descriptor instead.

func (*ListUserRequest) GetLimit

func (x *ListUserRequest) GetLimit() int64

func (*ListUserRequest) GetOffset

func (x *ListUserRequest) GetOffset() int64

func (*ListUserRequest) ProtoMessage

func (*ListUserRequest) ProtoMessage()

func (*ListUserRequest) ProtoReflect

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

func (*ListUserRequest) Reset

func (x *ListUserRequest) Reset()

func (*ListUserRequest) String

func (x *ListUserRequest) String() string

type ListUserResponse

type ListUserResponse struct {
	TotalCount int64       `protobuf:"varint,1,opt,name=totalCount,proto3" json:"totalCount,omitempty"`
	Users      []*UserInfo `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"`
	// contains filtered or unexported fields
}

ListUserResponse 指定了 `GET /v1/users` 接口的返回参数,相当于 HTTP Response.

func (*ListUserResponse) Descriptor deprecated

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

Deprecated: Use ListUserResponse.ProtoReflect.Descriptor instead.

func (*ListUserResponse) GetTotalCount

func (x *ListUserResponse) GetTotalCount() int64

func (*ListUserResponse) GetUsers

func (x *ListUserResponse) GetUsers() []*UserInfo

func (*ListUserResponse) ProtoMessage

func (*ListUserResponse) ProtoMessage()

func (*ListUserResponse) ProtoReflect

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

func (*ListUserResponse) Reset

func (x *ListUserResponse) Reset()

func (*ListUserResponse) String

func (x *ListUserResponse) String() string

type MiniBlogClient

type MiniBlogClient interface {
	ListUser(ctx context.Context, in *ListUserRequest, opts ...grpc.CallOption) (*ListUserResponse, error)
}

MiniBlogClient is the client API for MiniBlog service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewMiniBlogClient

func NewMiniBlogClient(cc grpc.ClientConnInterface) MiniBlogClient

type MiniBlogServer

type MiniBlogServer interface {
	ListUser(context.Context, *ListUserRequest) (*ListUserResponse, error)
	// contains filtered or unexported methods
}

MiniBlogServer is the server API for MiniBlog service. All implementations must embed UnimplementedMiniBlogServer for forward compatibility

type ModifierExample

type ModifierExample struct {
	Username string           `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Nickname *string          `protobuf:"bytes,3,opt,name=nickname,proto3,oneof" json:"nickname,omitempty"` // 可选值
	HasEmail bool             `protobuf:"varint,4,opt,name=hasEmail,proto3" json:"hasEmail,omitempty"`
	Phones   []string         `protobuf:"bytes,5,rep,name=phones,proto3" json:"phones,omitempty"` // 任意数量(包括0),可以看成是一个数组.
	Content  []byte           `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"`
	Money    int32            `protobuf:"varint,7,opt,name=money,proto3" json:"money,omitempty"`
	Count    int64            `protobuf:"varint,8,opt,name=count,proto3" json:"count,omitempty"`
	Address  map[string]int64 `` // 编译后:`Address   map[string]string`
	/* 156-byte string literal not displayed */
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
	// contains filtered or unexported fields
}

示例 message 定义,用来展示 protobuf 修饰符,编译后的效果

func (*ModifierExample) Descriptor deprecated

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

Deprecated: Use ModifierExample.ProtoReflect.Descriptor instead.

func (*ModifierExample) GetAddress

func (x *ModifierExample) GetAddress() map[string]int64

func (*ModifierExample) GetContent

func (x *ModifierExample) GetContent() []byte

func (*ModifierExample) GetCount

func (x *ModifierExample) GetCount() int64

func (*ModifierExample) GetCreatedAt

func (x *ModifierExample) GetCreatedAt() *timestamppb.Timestamp

func (*ModifierExample) GetHasEmail

func (x *ModifierExample) GetHasEmail() bool

func (*ModifierExample) GetMoney

func (x *ModifierExample) GetMoney() int32

func (*ModifierExample) GetNickname

func (x *ModifierExample) GetNickname() string

func (*ModifierExample) GetPhones

func (x *ModifierExample) GetPhones() []string

func (*ModifierExample) GetUsername

func (x *ModifierExample) GetUsername() string

func (*ModifierExample) ProtoMessage

func (*ModifierExample) ProtoMessage()

func (*ModifierExample) ProtoReflect

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

func (*ModifierExample) Reset

func (x *ModifierExample) Reset()

func (*ModifierExample) String

func (x *ModifierExample) String() string

type UnimplementedMiniBlogServer

type UnimplementedMiniBlogServer struct {
}

UnimplementedMiniBlogServer must be embedded to have forward compatible implementations.

func (UnimplementedMiniBlogServer) ListUser

type UnsafeMiniBlogServer

type UnsafeMiniBlogServer interface {
	// contains filtered or unexported methods
}

UnsafeMiniBlogServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MiniBlogServer will result in compilation errors.

type UserInfo

type UserInfo struct {
	Username  string                 `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Nickname  string                 `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"`
	Email     string                 `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Phone     string                 `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
	PostCount int64                  `protobuf:"varint,5,opt,name=postCount,proto3" json:"postCount,omitempty"`
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
	// contains filtered or unexported fields
}

func (*UserInfo) Descriptor deprecated

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

Deprecated: Use UserInfo.ProtoReflect.Descriptor instead.

func (*UserInfo) GetCreatedAt

func (x *UserInfo) GetCreatedAt() *timestamppb.Timestamp

func (*UserInfo) GetEmail

func (x *UserInfo) GetEmail() string

func (*UserInfo) GetNickname

func (x *UserInfo) GetNickname() string

func (*UserInfo) GetPhone

func (x *UserInfo) GetPhone() string

func (*UserInfo) GetPostCount

func (x *UserInfo) GetPostCount() int64

func (*UserInfo) GetUpdatedAt

func (x *UserInfo) GetUpdatedAt() *timestamppb.Timestamp

func (*UserInfo) GetUsername

func (x *UserInfo) GetUsername() string

func (*UserInfo) ProtoMessage

func (*UserInfo) ProtoMessage()

func (*UserInfo) ProtoReflect

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

func (*UserInfo) Reset

func (x *UserInfo) Reset()

func (*UserInfo) String

func (x *UserInfo) String() string

Jump to

Keyboard shortcuts

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