samplesvc

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: MIT Imports: 8 Imported by: 0

README

Samplesvc

Samplesvc is a sample for the restgen and also works as a testcase for the generated code.

To run the test you have to

go generate

and

go test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigTestMock

type BigTestMock struct {
	Small map[uint32]*pb.Small
}

BigTestMock represents logic reachable via a REST endpoint.

func NewBigTestMock

func NewBigTestMock() *BigTestMock

NewBigTestMock instantiates a new BigTestMock

func (*BigTestMock) CreateHaveAll

CreateHaveAll should create a HaveAll message. Excluded from HaveAll are the "repeated"-fields (slices). This is not supported at the moment.

func (*BigTestMock) DeepPath

DeepPath retrieves a value deeply nested in structs and returns this value.

func (*BigTestMock) DeleteSmall

DeleteSmall deletes a Small message from a storage.

func (*BigTestMock) DoNotCreate

DoNotCreate is a testcase for a method without an method_map option. Therefore no REST frontend should be generated

func (*BigTestMock) EmptyRequestMessage

EmptyRequestMessage returns an empty protobuf message.

func (*BigTestMock) GetHaveAll

GetHaveAll should retrieve the HaveAll message with the id given in the path Excluded from HaveAll are the "repeated"-fields (slices). This is not supported at the moment.

func (*BigTestMock) GetLongPath

GetLongPath returns one value of more than one path parameter.

func (*BigTestMock) GetPathPath

GetPathPath returns the given value of a deeply nested struct.

func (*BigTestMock) GetSmall

GetSmall returns a Small message identified by a given ID.

func (*BigTestMock) GetSmall1

func (b *BigTestMock) GetSmall1(ctx context.Context, req *pb.GetSmallRequest) (*pb.GetSmallResponse, error)

GetSmall1 is just a test for route registration, that's why no logic.

func (*BigTestMock) PageSortFilter

PageSortFilter returns the given values of the Page, Sort and Filter messages.

func (*BigTestMock) PostSmall

PostSmall is a flaw: id of the updated resource should be in the URI. An id from the URI should be mapped into posted objects.

func (*BigTestMock) PutSmall

PutSmall adds a Small message to a storage.

type GeneratedService

type GeneratedService struct {
	Service pb.BigTestServiceServer
	// contains filtered or unexported fields
}

func NewGeneratedService

func NewGeneratedService(s pb.BigTestServiceServer, errorHandler rest.ErrorHandler) (*GeneratedService, error)

func (*GeneratedService) CreateHaveAll

func (s *GeneratedService) CreateHaveAll(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) DeepPath

func (s *GeneratedService) DeepPath(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) DeleteSmall

func (s *GeneratedService) DeleteSmall(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) EmptyRequestMessage

func (s *GeneratedService) EmptyRequestMessage(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) GetBaseURI

func (s *GeneratedService) GetBaseURI() string

func (*GeneratedService) GetHandlersToRegister

func (s *GeneratedService) GetHandlersToRegister() []rest.Register

func (*GeneratedService) GetHaveAll

func (s *GeneratedService) GetHaveAll(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) GetLongPath

func (s *GeneratedService) GetLongPath(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) GetPathPath

func (s *GeneratedService) GetPathPath(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) GetSmall

func (s *GeneratedService) GetSmall(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) GetSmall1

func (s *GeneratedService) GetSmall1(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) PageSortFilter

func (s *GeneratedService) PageSortFilter(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) PostSmall

func (s *GeneratedService) PostSmall(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) PutSmall

func (s *GeneratedService) PutSmall(w http.ResponseWriter, r *http.Request)

func (*GeneratedService) SetErrorHandler

func (s *GeneratedService) SetErrorHandler(h rest.ErrorHandler) error

type QSParameter

type QSParameter struct {
	Key   string // Which key
	Field string // goes to which field in a go struct
	Type  string // should have what type
}

Directories

Path Synopsis
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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