Skip to content

Commit

Permalink
Export makeEndpoint in kitgen (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffo authored and peterbourgon committed Dec 12, 2017
1 parent ebf82f4 commit 1b4cf21
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cmd/kitgen/method.go
Expand Up @@ -143,7 +143,7 @@ func (m method) encoderFunc() ast.Decl {
}

func (m method) endpointMakerName() *ast.Ident {
return id("make" + m.name.Name + "Endpoint")
return id("Make" + m.name.Name + "Endpoint")
}

func (m method) requestStruct() ast.Decl {
Expand Down
Expand Up @@ -15,7 +15,7 @@ type FooResponse struct {
Err error
}

func makeFooEndpoint(s service.Service) endpoint.Endpoint {
func MakeFooEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(FooRequest)
i, err := s.Foo(ctx, req.I, req.S)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kitgen/testdata/anonfields/flat/gokit.go
Expand Up @@ -23,7 +23,7 @@ type FooResponse struct {
Err error
}

func makeFooEndpoint(s Service) endpoint.Endpoint {
func MakeFooEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(FooRequest)
i, err := s.Foo(ctx, req.I, req.S)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kitgen/testdata/foo/default/endpoints/endpoints.go
Expand Up @@ -15,7 +15,7 @@ type BarResponse struct {
Err error
}

func makeBarEndpoint(f service.FooService) endpoint.Endpoint {
func MakeBarEndpoint(f service.FooService) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(BarRequest)
s, err := f.Bar(ctx, req.I, req.S)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kitgen/testdata/foo/flat/gokit.go
Expand Up @@ -23,7 +23,7 @@ type BarResponse struct {
Err error
}

func makeBarEndpoint(f FooService) endpoint.Endpoint {
func MakeBarEndpoint(f FooService) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(BarRequest)
s, err := f.Bar(ctx, req.I, req.S)
Expand Down
18 changes: 9 additions & 9 deletions cmd/kitgen/testdata/profilesvc/default/endpoints/endpoints.go
Expand Up @@ -13,7 +13,7 @@ type PostProfileResponse struct {
Err error
}

func makePostProfileEndpoint(s service.Service) endpoint.Endpoint {
func MakePostProfileEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PostProfileRequest)
err := s.PostProfile(ctx, req.P)
Expand All @@ -29,7 +29,7 @@ type GetProfileResponse struct {
Err error
}

func makeGetProfileEndpoint(s service.Service) endpoint.Endpoint {
func MakeGetProfileEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(GetProfileRequest)
P, err := s.GetProfile(ctx, req.Id)
Expand All @@ -45,7 +45,7 @@ type PutProfileResponse struct {
Err error
}

func makePutProfileEndpoint(s service.Service) endpoint.Endpoint {
func MakePutProfileEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PutProfileRequest)
err := s.PutProfile(ctx, req.Id, req.P)
Expand All @@ -61,7 +61,7 @@ type PatchProfileResponse struct {
Err error
}

func makePatchProfileEndpoint(s service.Service) endpoint.Endpoint {
func MakePatchProfileEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PatchProfileRequest)
err := s.PatchProfile(ctx, req.Id, req.P)
Expand All @@ -76,7 +76,7 @@ type DeleteProfileResponse struct {
Err error
}

func makeDeleteProfileEndpoint(s service.Service) endpoint.Endpoint {
func MakeDeleteProfileEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(DeleteProfileRequest)
err := s.DeleteProfile(ctx, req.Id)
Expand All @@ -92,7 +92,7 @@ type GetAddressesResponse struct {
Err error
}

func makeGetAddressesEndpoint(s service.Service) endpoint.Endpoint {
func MakeGetAddressesEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(GetAddressesRequest)
slice1, err := s.GetAddresses(ctx, req.ProfileID)
Expand All @@ -109,7 +109,7 @@ type GetAddressResponse struct {
Err error
}

func makeGetAddressEndpoint(s service.Service) endpoint.Endpoint {
func MakeGetAddressEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(GetAddressRequest)
A, err := s.GetAddress(ctx, req.ProfileID, req.AddressID)
Expand All @@ -125,7 +125,7 @@ type PostAddressResponse struct {
Err error
}

func makePostAddressEndpoint(s service.Service) endpoint.Endpoint {
func MakePostAddressEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PostAddressRequest)
err := s.PostAddress(ctx, req.ProfileID, req.A)
Expand All @@ -141,7 +141,7 @@ type DeleteAddressResponse struct {
Err error
}

func makeDeleteAddressEndpoint(s service.Service) endpoint.Endpoint {
func MakeDeleteAddressEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(DeleteAddressRequest)
err := s.DeleteAddress(ctx, req.ProfileID, req.AddressID)
Expand Down
18 changes: 9 additions & 9 deletions cmd/kitgen/testdata/profilesvc/flat/gokit.go
Expand Up @@ -30,7 +30,7 @@ type PostProfileResponse struct {
Err error
}

func makePostProfileEndpoint(s Service) endpoint.Endpoint {
func MakePostProfileEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PostProfileRequest)
err := s.PostProfile(ctx, req.P)
Expand All @@ -49,7 +49,7 @@ type GetProfileResponse struct {
Err error
}

func makeGetProfileEndpoint(s Service) endpoint.Endpoint {
func MakeGetProfileEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(GetProfileRequest)
P, err := s.GetProfile(ctx, req.Id)
Expand All @@ -68,7 +68,7 @@ type PutProfileResponse struct {
Err error
}

func makePutProfileEndpoint(s Service) endpoint.Endpoint {
func MakePutProfileEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PutProfileRequest)
err := s.PutProfile(ctx, req.Id, req.P)
Expand All @@ -87,7 +87,7 @@ type PatchProfileResponse struct {
Err error
}

func makePatchProfileEndpoint(s Service) endpoint.Endpoint {
func MakePatchProfileEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PatchProfileRequest)
err := s.PatchProfile(ctx, req.Id, req.P)
Expand All @@ -105,7 +105,7 @@ type DeleteProfileResponse struct {
Err error
}

func makeDeleteProfileEndpoint(s Service) endpoint.Endpoint {
func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(DeleteProfileRequest)
err := s.DeleteProfile(ctx, req.Id)
Expand All @@ -124,7 +124,7 @@ type GetAddressesResponse struct {
Err error
}

func makeGetAddressesEndpoint(s Service) endpoint.Endpoint {
func MakeGetAddressesEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(GetAddressesRequest)
slice1, err := s.GetAddresses(ctx, req.ProfileID)
Expand All @@ -144,7 +144,7 @@ type GetAddressResponse struct {
Err error
}

func makeGetAddressEndpoint(s Service) endpoint.Endpoint {
func MakeGetAddressEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(GetAddressRequest)
A, err := s.GetAddress(ctx, req.ProfileID, req.AddressID)
Expand All @@ -163,7 +163,7 @@ type PostAddressResponse struct {
Err error
}

func makePostAddressEndpoint(s Service) endpoint.Endpoint {
func MakePostAddressEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(PostAddressRequest)
err := s.PostAddress(ctx, req.ProfileID, req.A)
Expand All @@ -182,7 +182,7 @@ type DeleteAddressResponse struct {
Err error
}

func makeDeleteAddressEndpoint(s Service) endpoint.Endpoint {
func MakeDeleteAddressEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(DeleteAddressRequest)
err := s.DeleteAddress(ctx, req.ProfileID, req.AddressID)
Expand Down
Expand Up @@ -15,7 +15,7 @@ type ConcatResponse struct {
Err error
}

func makeConcatEndpoint(s service.Service) endpoint.Endpoint {
func MakeConcatEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(ConcatRequest)
string1, err := s.Concat(ctx, req.A, req.B)
Expand All @@ -30,7 +30,7 @@ type CountResponse struct {
Count int
}

func makeCountEndpoint(s service.Service) endpoint.Endpoint {
func MakeCountEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(CountRequest)
count := s.Count(ctx, req.S)
Expand Down
4 changes: 2 additions & 2 deletions cmd/kitgen/testdata/stringservice/flat/gokit.go
Expand Up @@ -23,7 +23,7 @@ type ConcatResponse struct {
Err error
}

func makeConcatEndpoint(s Service) endpoint.Endpoint {
func MakeConcatEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(ConcatRequest)
string1, err := s.Concat(ctx, req.A, req.B)
Expand All @@ -41,7 +41,7 @@ type CountResponse struct {
Count int
}

func makeCountEndpoint(s Service) endpoint.Endpoint {
func MakeCountEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(CountRequest)
count := s.Count(ctx, req.S)
Expand Down
Expand Up @@ -14,7 +14,7 @@ type FooResponse struct {
Err error
}

func makeFooEndpoint(s service.Service) endpoint.Endpoint {
func MakeFooEndpoint(s service.Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(FooRequest)
i, err := s.Foo(ctx, req.I)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kitgen/testdata/underscores/flat/gokit.go
Expand Up @@ -22,7 +22,7 @@ type FooResponse struct {
Err error
}

func makeFooEndpoint(s Service) endpoint.Endpoint {
func MakeFooEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(FooRequest)
i, err := s.Foo(ctx, req.I)
Expand Down

0 comments on commit 1b4cf21

Please sign in to comment.