You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/08/12 08:56:28 UTC

[GitHub] [skywalking-banyandb] lujiajing1126 commented on a change in pull request #33: feat: Implement Query in the liaison

lujiajing1126 commented on a change in pull request #33:
URL: https://github.com/apache/skywalking-banyandb/pull/33#discussion_r687521414



##########
File path: banyand/liaison/grpc/grpc.go
##########
@@ -334,9 +335,30 @@ func (s *Server) Write(TraceWriteServer v1.TraceService_WriteServer) error {
 }
 
 func (s *Server) Query(ctx context.Context, entityCriteria *v1.QueryRequest) (*v1.QueryResponse, error) {
-	log.Println("entityCriteria:", entityCriteria)
-
-	return &v1.QueryResponse{}, nil
+	message := bus.NewMessage(bus.MessageID(time.Now().UnixNano()), entityCriteria)
+	feat, errQuery := s.pipeline.Publish(data.TopicQueryEvent, message)
+	if errQuery != nil {
+		return nil, errQuery
+	}
+	msg, errFeat := feat.Get()
+	if errFeat != nil {
+		return nil, errFeat
+	}
+	queryMsg := msg.Data()
+
+	var arr []*v1.Entity
+	switch reflect.TypeOf(queryMsg).Kind() {

Review comment:
       You actually do not need reflect here.
   
   Just use [type-assertion](https://tour.golang.org/methods/15), see the examples.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org