v1

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PetService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v1.PetService",
	HandlerType: (*PetServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _PetService_Create_Handler,
		},
		{
			MethodName: "List",
			Handler:    _PetService_List_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _PetService_Get_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _PetService_Update_Handler,
		},
		{
			MethodName: "Remove",
			Handler:    _PetService_Remove_Handler,
		},
		{
			MethodName: "RemoveAll",
			Handler:    _PetService_RemoveAll_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pet.proto",
}

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

Functions

func RegisterPetServiceServer

func RegisterPetServiceServer(s grpc.ServiceRegistrar, srv PetServiceServer)

Types

type CreateRequest

type CreateRequest struct {
	Title       string   `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Price       int32    `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	FeatureTags []string `protobuf:"bytes,4,rep,name=feature_tags,json=featureTags,proto3" json:"feature_tags,omitempty"`
	Attrs       []byte   `protobuf:"bytes,5,opt,name=attrs,proto3" json:"attrs,omitempty"`
	// contains filtered or unexported fields
}

CreateRequest is the request for the calling remote creating service

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetAttrs

func (x *CreateRequest) GetAttrs() []byte

func (*CreateRequest) GetFeatureTags

func (x *CreateRequest) GetFeatureTags() []string

func (*CreateRequest) GetPrice

func (x *CreateRequest) GetPrice() int32

func (*CreateRequest) GetTitle

func (x *CreateRequest) GetTitle() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

func (*CreateRequest) Validate

func (req *CreateRequest) Validate() error

Validate validates the CreateRequest. It implements the grpcs.RequestValidator interface.

type CreateResponse

type CreateResponse struct {
	Pet *PetDTO `protobuf:"bytes,1,opt,name=pet,proto3" json:"pet,omitempty"`
	// contains filtered or unexported fields
}

CreateResponse contains a pet.

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetPet

func (x *CreateResponse) GetPet() *PetDTO

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type GetRequest

type GetRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

GetRequest is the request for the getting gRPC call.

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetId

func (x *GetRequest) GetId() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

func (*GetRequest) Validate

func (req *GetRequest) Validate() error

Validate validates the GetRequest. It implements the grpcs.ResponseValidator interface.

type GetResponse

type GetResponse struct {
	Pet *PetDTO `protobuf:"bytes,1,opt,name=pet,proto3" json:"pet,omitempty"`
	// contains filtered or unexported fields
}

GetResponse contains a pet.

func (*GetResponse) Descriptor deprecated

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetPet

func (x *GetResponse) GetPet() *PetDTO

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

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

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

type ListResponse

type ListResponse struct {
	Pets []*PetDTO `protobuf:"bytes,1,rep,name=pets,proto3" json:"pets,omitempty"`
	// contains filtered or unexported fields
}

ListResponse contains a list of pets.

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetPets

func (x *ListResponse) GetPets() []*PetDTO

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type Pet

type Pet struct {
	ID          string                 `json:"id"`
	Title       string                 `json:"title"`
	Price       int32                  `json:"price"`
	FeatureTags []string               `json:"feature_tags"`
	Attrs       map[string]interface{} `json:"attrs"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Ver         int32                  `json:"ver"`
}

type PetDTO

type PetDTO struct {
	Id          string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Title       string                 `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Price       int32                  `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	FeatureTags []string               `protobuf:"bytes,4,rep,name=feature_tags,json=featureTags,proto3" json:"feature_tags,omitempty"`
	Attrs       []byte                 `protobuf:"bytes,5,opt,name=attrs,proto3" json:"attrs,omitempty"`
	CreatedAt   *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt   *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	Version     int32                  `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

Pet is the DTO for a pet.

func (*PetDTO) Descriptor deprecated

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

Deprecated: Use PetDTO.ProtoReflect.Descriptor instead.

func (*PetDTO) GetAttrs

func (x *PetDTO) GetAttrs() []byte

func (*PetDTO) GetCreatedAt

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

func (*PetDTO) GetFeatureTags

func (x *PetDTO) GetFeatureTags() []string

func (*PetDTO) GetId

func (x *PetDTO) GetId() string

func (*PetDTO) GetPrice

func (x *PetDTO) GetPrice() int32

func (*PetDTO) GetTitle

func (x *PetDTO) GetTitle() string

func (*PetDTO) GetUpdatedAt

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

func (*PetDTO) GetVersion

func (x *PetDTO) GetVersion() int32

func (*PetDTO) ProtoMessage

func (*PetDTO) ProtoMessage()

func (*PetDTO) ProtoReflect

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

func (*PetDTO) Reset

func (x *PetDTO) Reset()

func (*PetDTO) String

func (x *PetDTO) String() string

type PetServiceClient

type PetServiceClient interface {
	// Create creates a new pet.
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// List lists all pets.
	List(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListResponse, error)
	// Get gets a pet.
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
	// Update updates a pet.
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
	// Remove removes a pet.
	Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// RemoveAll removes all pets.
	RemoveAll(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

PetServiceClient is the client API for PetService 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 NewPetServiceClient

func NewPetServiceClient(cc grpc.ClientConnInterface) PetServiceClient

type PetServiceServer

type PetServiceServer interface {
	// Create creates a new pet.
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// List lists all pets.
	List(context.Context, *emptypb.Empty) (*ListResponse, error)
	// Get gets a pet.
	Get(context.Context, *GetRequest) (*GetResponse, error)
	// Update updates a pet.
	Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
	// Remove removes a pet.
	Remove(context.Context, *RemoveRequest) (*emptypb.Empty, error)
	// RemoveAll removes all pets.
	RemoveAll(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

PetServiceServer is the server API for PetService service. All implementations must embed UnimplementedPetServiceServer for forward compatibility

type RPClient

type RPClient struct {
	// contains filtered or unexported fields
}

RPClient is the gRPC client

func New

func New(host string, port string, tls bool) *RPClient

New creates a new gRPC client

func NewWithConn

func NewWithConn(conn *grpc.ClientConn) *RPClient

NewWithConn creates a new gRPC client with an existing connection

func NewWithURL

func NewWithURL(grpcUrl string) *RPClient

func (*RPClient) Create

func (c *RPClient) Create(
	ctx context.Context,
	title string,
	price int32,
	featureTags []string,
	attrs map[string]interface{},
) (*Pet, error)

Create is a gRPC client method to call the CreatePet method on the gRPC server

func (*RPClient) Get

func (c *RPClient) Get(
	ctx context.Context,
	id string,
) (*Pet, error)

Get is a gRPC client method to call the GetPet method on the gRPC server

func (*RPClient) List

func (c *RPClient) List(
	ctx context.Context,
) ([]*Pet, error)

List is a gRPC client method to call the ListPets method on the gRPC server

func (*RPClient) Remove

func (c *RPClient) Remove(
	ctx context.Context,
	id string,
) error

Remove is a gRPC client method to call the DeletePet method on the gRPC server

func (*RPClient) RemoveAll

func (c *RPClient) RemoveAll(
	ctx context.Context,
) error

RemoveAll is a gRPC client method to call the remove all pets on the gRPC server

func (*RPClient) Update

func (c *RPClient) Update(
	ctx context.Context,
	id string,
	title string,
) (*Pet, error)

Update is a gRPC client method to call the UpdatePet method on the gRPC server

type RemoveRequest

type RemoveRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

RemoveRequest is the request for the removing gRPC call.

func (*RemoveRequest) Descriptor deprecated

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

Deprecated: Use RemoveRequest.ProtoReflect.Descriptor instead.

func (*RemoveRequest) GetId

func (x *RemoveRequest) GetId() string

func (*RemoveRequest) ProtoMessage

func (*RemoveRequest) ProtoMessage()

func (*RemoveRequest) ProtoReflect

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

func (*RemoveRequest) Reset

func (x *RemoveRequest) Reset()

func (*RemoveRequest) String

func (x *RemoveRequest) String() string

func (*RemoveRequest) Validate

func (req *RemoveRequest) Validate() error

Validate validates the RemoveRequest. It implements the grpcs.RequestValidator interface.

type UnimplementedPetServiceServer

type UnimplementedPetServiceServer struct {
}

UnimplementedPetServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedPetServiceServer) Create

func (UnimplementedPetServiceServer) Get

func (UnimplementedPetServiceServer) List

func (UnimplementedPetServiceServer) Remove

func (UnimplementedPetServiceServer) RemoveAll

func (UnimplementedPetServiceServer) Update

type UnsafePetServiceServer

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

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

type UpdateRequest

type UpdateRequest struct {
	Id    string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	// contains filtered or unexported fields
}

UpdateRequest is the request for the updating gRPC call.

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetId

func (x *UpdateRequest) GetId() string

func (*UpdateRequest) GetTitle

func (x *UpdateRequest) GetTitle() string

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

func (*UpdateRequest) Validate

func (req *UpdateRequest) Validate() error

Validate validates the UpdateRequest. It implements the grpcs.RequestValidator interface.

type UpdateResponse

type UpdateResponse struct {
	Pet *PetDTO `protobuf:"bytes,1,opt,name=pet,proto3" json:"pet,omitempty"`
	// contains filtered or unexported fields
}

UpdateResponse contains a pet.

func (*UpdateResponse) Descriptor deprecated

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

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) GetPet

func (x *UpdateResponse) GetPet() *PetDTO

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect

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

func (*UpdateResponse) Reset

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String

func (x *UpdateResponse) String() string

Jump to

Keyboard shortcuts

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