-
Notifications
You must be signed in to change notification settings - Fork 68
/
endpoints.go
45 lines (38 loc) · 1 KB
/
endpoints.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Code generated by goa v3.16.2, DO NOT EDIT.
//
// sommelier endpoints
//
// Command:
// $ goa gen goa.design/examples/cellar/design
package sommelier
import (
"context"
goa "goa.design/goa/v3/pkg"
)
// Endpoints wraps the "sommelier" service endpoints.
type Endpoints struct {
Pick goa.Endpoint
}
// NewEndpoints wraps the methods of the "sommelier" service with endpoints.
func NewEndpoints(s Service) *Endpoints {
return &Endpoints{
Pick: NewPickEndpoint(s),
}
}
// Use applies the given middleware to all the "sommelier" service endpoints.
func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint) {
e.Pick = m(e.Pick)
}
// NewPickEndpoint returns an endpoint function that calls the method "pick" of
// service "sommelier".
func NewPickEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*Criteria)
res, err := s.Pick(ctx, p)
if err != nil {
return nil, err
}
vres := NewViewedStoredBottleCollection(res, "default")
return vres, nil
}
}