-
Notifications
You must be signed in to change notification settings - Fork 39
PMM-3632 Fix bugs. #166
PMM-3632 Fix bugs. #166
Changes from all commits
571a56a
0f43397
7c7d83f
9fc7295
89cc735
5d72fbc
6964a49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,9 +37,12 @@ func NewServicesServer(s *inventory.ServicesService) inventorypb.ServicesServer | |
| return &servicesServer{s} | ||
| } | ||
|
|
||
| // ListServices returns a list of all Services. | ||
| // ListServices returns a list of Services for a given filters. | ||
| func (s *servicesServer) ListServices(ctx context.Context, req *inventorypb.ListServicesRequest) (*inventorypb.ListServicesResponse, error) { | ||
| services, err := s.s.List(ctx) | ||
| filters := inventory.ServiceFilters{ | ||
| NodeID: req.GetNodeId(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, prefer fields to methods.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can't use field here because in proto file we used
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| } | ||
| services, err := s.s.List(ctx, filters) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
@@ -53,6 +56,8 @@ func (s *servicesServer) ListServices(ctx context.Context, req *inventorypb.List | |
| res.AmazonRdsMysql = append(res.AmazonRdsMysql, service) | ||
| case *inventorypb.MongoDBService: | ||
| res.Mongodb = append(res.Mongodb, service) | ||
| case *inventorypb.PostgreSQLService: | ||
| res.Postgresql = append(res.Postgresql, service) | ||
| default: | ||
| panic(fmt.Errorf("unhandled inventory Service type %T", service)) | ||
| } | ||
|
|
@@ -75,6 +80,8 @@ func (s *servicesServer) GetService(ctx context.Context, req *inventorypb.GetSer | |
| res.Service = &inventorypb.GetServiceResponse_AmazonRdsMysql{AmazonRdsMysql: service} | ||
| case *inventorypb.MongoDBService: | ||
| res.Service = &inventorypb.GetServiceResponse_Mongodb{Mongodb: service} | ||
| case *inventorypb.PostgreSQLService: | ||
| res.Service = &inventorypb.GetServiceResponse_Postgresql{Postgresql: service} | ||
| default: | ||
| panic(fmt.Errorf("unhandled inventory Service type %T", service)) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, @dexterHD @BupycHuk: what do you think about switching to plain placeholders? Like:
We used
q.Placeholder(1)because we knew we are going to switch away from MySQL to either SQLite or PostgreSQL, and they have different placeholder syntax. We switched, and very unlikely to switch again, so we can make things clearer.