Created
September 7, 2017 13:26
-
-
Save rahulbir/06434635506ca817263da74d98d2fef6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/leftronic/dataset-api/datasetsvc" | |
"google.golang.org/grpc" | |
"context" | |
"fmt" | |
"encoding/json" | |
) | |
func main() { | |
opts := []grpc.DialOption{grpc.WithInsecure()} | |
clientConnection, err := grpc.Dial(":10000", opts...) | |
datasetClient := datasetsvc.NewDataSetSvcClient(clientConnection) | |
listRowsClient, err := datasetClient.ListRows(context.Background(), &datasetsvc.ListRowsRequest{SourceId: "", TargetId:"", Name: "test"}) | |
for { | |
row, err := listRowsClient.Recv() | |
if err != nil { | |
// check for actual errors | |
// IO - EOF no more to receive ? | |
break | |
} | |
fmt.Println(row) // struct with data field as []byte | |
var rowData []interface{} | |
marshallError := json.Unmarshal(row.Data, rowData) | |
if marshallError != nil { | |
break | |
} | |
fmt.Println(rowData) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment