Documentation ¶
Index ¶
- func CustomHTTPError(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, ...)
- type Database
- type PetstoreServer
- func (s *PetstoreServer) AddPet(ctx context.Context, req *pb.Pet) (*pb.Pet, error)
- func (s *PetstoreServer) DeletePet(ctx context.Context, req *pb.PetID) (*pb.Empty, error)
- func (s *PetstoreServer) FindPetsByStatus(ctx context.Context, req *pb.StatusReq) (*pb.Pets, error)
- func (s *PetstoreServer) GetPetByID(ctx context.Context, req *pb.PetID) (*pb.Pet, error)
- func (s *PetstoreServer) Run()
- func (s *PetstoreServer) UpdatePet(ctx context.Context, req *pb.Pet) (*pb.Pet, error)
- func (s *PetstoreServer) UpdatePetWithForm(ctx context.Context, req *pb.UpdatePetWithFormReq) (*pb.Empty, error)
- func (s *PetstoreServer) UploadFile(ctx context.Context, req *pb.UploadFileReq) (*pb.ApiResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database interface { GetPetByID(ctx context.Context, id int64) (*pb.Pet, error) UpdatePetWithForm(ctx context.Context, id int64, name string, status string) error DeletePet(ctx context.Context, id int64) error UploadFile(ctx context.Context, id int64, url string) error AddPet(ctx context.Context, pet *pb.Pet) error UpdatePet(ctx context.Context, pet *pb.Pet) error FindPetsByStatus(ctx context.Context, statuses []string) (*pb.Pets, error) }
Database defines the set of methods that the petstore server needs to be able to treat any object as a database
type PetstoreServer ¶
type PetstoreServer struct {
// contains filtered or unexported fields
}
PetstoreServer implements the RPC and REST server
func NewPetstoreServer ¶
func NewPetstoreServer(log *logrus.Logger, db Database, rcpPort, restPort int, apiKey string) *PetstoreServer
NewPetstoreServer returns a new PetstoreServer
func (*PetstoreServer) DeletePet ¶
DeletePet removes a pet. Check the req header for the API_KEY value
func (*PetstoreServer) FindPetsByStatus ¶
FindPetsByStatus gets all the pets that match any of the passed in statuses
func (*PetstoreServer) GetPetByID ¶
GetPetByID implements PetstoreService rpc
func (*PetstoreServer) UpdatePetWithForm ¶
func (s *PetstoreServer) UpdatePetWithForm(ctx context.Context, req *pb.UpdatePetWithFormReq) (*pb.Empty, error)
UpdatePetWithForm updates the name and status of a Pet using form encoded data, converted to protobuf
func (*PetstoreServer) UploadFile ¶
func (s *PetstoreServer) UploadFile(ctx context.Context, req *pb.UploadFileReq) (*pb.ApiResponse, error)
UploadFile uploads a photo against a pet
Click to show internal directories.
Click to hide internal directories.