api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_user_api_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "example.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateUser",
			Handler:    _UserService_CreateUser_Handler,
		},
		{
			MethodName: "DeleteUser",
			Handler:    _UserService_DeleteUser_Handler,
		},
		{
			MethodName: "UpdateUser",
			Handler:    _UserService_UpdateUser_Handler,
		},
		{
			MethodName: "GetUser",
			Handler:    _UserService_GetUser_Handler,
		},
		{
			MethodName: "ListUsers",
			Handler:    _UserService_ListUsers_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/user.api.proto",
}

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

Functions

func RegisterUserServiceHTTP added in v0.0.2

func RegisterUserServiceHTTP(e *gin.Engine, svr UserServiceHTTPServer, middleware map[string][]gin.HandlerFunc)

func RegisterUserServiceServer

func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)

Types

type ListUsersReq

type ListUsersReq struct {

	// number of page
	Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty" form:"page"` // @gotags: form:"page"
	// default 20
	PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty" form:"page_size"` // @gotags: form:"page_size"
	// order by  for example :  [-id]  -: DESC
	OrderBy string `protobuf:"bytes,3,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty" form:"order_by"` // @gotags: form:"order_by"
	//  id > ?
	IdGt int64 `protobuf:"varint,4,opt,name=id_gt,json=idGt,proto3" json:"id_gt,omitempty" form:"id_gt"` // @gotags: form:"id_gt"
	// contains filtered or unexported fields
}

func (*ListUsersReq) Descriptor deprecated

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

Deprecated: Use ListUsersReq.ProtoReflect.Descriptor instead.

func (*ListUsersReq) GetIdGt

func (x *ListUsersReq) GetIdGt() int64

func (*ListUsersReq) GetOrderBy

func (x *ListUsersReq) GetOrderBy() string

func (*ListUsersReq) GetPage

func (x *ListUsersReq) GetPage() int64

func (*ListUsersReq) GetPageSize

func (x *ListUsersReq) GetPageSize() int64

func (*ListUsersReq) ProtoMessage

func (*ListUsersReq) ProtoMessage()

func (*ListUsersReq) ProtoReflect

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

func (*ListUsersReq) Reset

func (x *ListUsersReq) Reset()

func (*ListUsersReq) String

func (x *ListUsersReq) String() string

type ListUsersResp

type ListUsersResp struct {
	Users      []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
	TotalCount int64   `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
	PageCount  int64   `protobuf:"varint,3,opt,name=page_count,json=pageCount,proto3" json:"page_count,omitempty"`
	// contains filtered or unexported fields
}

func (*ListUsersResp) Descriptor deprecated

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

Deprecated: Use ListUsersResp.ProtoReflect.Descriptor instead.

func (*ListUsersResp) GetPageCount

func (x *ListUsersResp) GetPageCount() int64

func (*ListUsersResp) GetTotalCount

func (x *ListUsersResp) GetTotalCount() int64

func (*ListUsersResp) GetUsers

func (x *ListUsersResp) GetUsers() []*User

func (*ListUsersResp) ProtoMessage

func (*ListUsersResp) ProtoMessage()

func (*ListUsersResp) ProtoReflect

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

func (*ListUsersResp) Reset

func (x *ListUsersResp) Reset()

func (*ListUsersResp) String

func (x *ListUsersResp) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) CreateUser

func (UnimplementedUserServiceServer) DeleteUser

func (UnimplementedUserServiceServer) GetUser

func (UnimplementedUserServiceServer) ListUsers

func (UnimplementedUserServiceServer) UpdateUser

type UnsafeUserServiceServer

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

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

type UpdateUserReq

type UpdateUserReq struct {
	User       *User    `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	UpdateMask []string `protobuf:"bytes,2,rep,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateUserReq) Descriptor deprecated

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

Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead.

func (*UpdateUserReq) GetUpdateMask

func (x *UpdateUserReq) GetUpdateMask() []string

func (*UpdateUserReq) GetUser

func (x *UpdateUserReq) GetUser() *User

func (*UpdateUserReq) ProtoMessage

func (*UpdateUserReq) ProtoMessage()

func (*UpdateUserReq) ProtoReflect

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

func (*UpdateUserReq) Reset

func (x *UpdateUserReq) Reset()

func (*UpdateUserReq) String

func (x *UpdateUserReq) String() string

type User

type User struct {

	//id字段
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	//名称
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	//年龄
	Age int64 `protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty"`
	//创建时间
	Ctime string `protobuf:"bytes,4,opt,name=ctime,proto3" json:"ctime,omitempty"`
	//更新时间
	Mtime string `protobuf:"bytes,5,opt,name=mtime,proto3" json:"mtime,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetAge

func (x *User) GetAge() int64

func (*User) GetCtime

func (x *User) GetCtime() string

func (*User) GetId

func (x *User) GetId() int64

func (*User) GetMtime

func (x *User) GetMtime() string

func (*User) GetName

func (x *User) GetName() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type UserId

type UserId struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" form:"id"` // @gotags: form:"id"
	// contains filtered or unexported fields
}

func (*UserId) Descriptor deprecated

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

Deprecated: Use UserId.ProtoReflect.Descriptor instead.

func (*UserId) GetId

func (x *UserId) GetId() int64

func (*UserId) ProtoMessage

func (*UserId) ProtoMessage()

func (*UserId) ProtoReflect

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

func (*UserId) Reset

func (x *UserId) Reset()

func (*UserId) String

func (x *UserId) String() string

type UserServiceClient

type UserServiceClient interface {
	CreateUser(ctx context.Context, in *User, opts ...grpc.CallOption) (*User, error)
	DeleteUser(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*emptypb.Empty, error)
	UpdateUser(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*User, error)
	GetUser(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
	ListUsers(ctx context.Context, in *ListUsersReq, opts ...grpc.CallOption) (*ListUsersResp, error)
}

UserServiceClient is the client API for UserService 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.

type UserServiceHTTPServer added in v0.0.2

type UserServiceHTTPServer interface {
	CreateUser(context.Context, *User) (*User, error)
	DeleteUser(context.Context, *UserId) (*emptypb.Empty, error)
	UpdateUser(context.Context, *UpdateUserReq) (*User, error)
	GetUser(context.Context, *UserId) (*User, error)
	ListUsers(context.Context, *ListUsersReq) (*ListUsersResp, error)
}

UserServiceHTTPServer is the server API for UserService service.

type UserServiceServer

type UserServiceServer interface {
	CreateUser(context.Context, *User) (*User, error)
	DeleteUser(context.Context, *UserId) (*emptypb.Empty, error)
	UpdateUser(context.Context, *UpdateUserReq) (*User, error)
	GetUser(context.Context, *UserId) (*User, error)
	ListUsers(context.Context, *ListUsersReq) (*ListUsersResp, error)
	// contains filtered or unexported methods
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

Jump to

Keyboard shortcuts

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