Beispiel #1
0
func getSketchInfo(in *pb.Sketch) error {
	in.Properties = &pb.SketchProperties{
		MaxUniqueItems: proto.Int64(0),
		Size:           proto.Int64(0),
	}
	reply, err := client.GetSketch(context.Background(), in)
	fmt.Println(reply)
	return err
}
Beispiel #2
0
func createSketch(fields []string, in *pb.Sketch) error {
	if in.GetType() != pb.SketchType_CARD {
		if len(fields) > 4 {
			return fmt.Errorf("Too many argumets, expected 4 got %d", len(fields))
		}
		num, err := strconv.Atoi(fields[3])
		if err != nil {
			return fmt.Errorf("Expected last argument to be of type int: %q", err)
		}

		in.Properties = &pb.SketchProperties{
			Size:           proto.Int64(int64(num)),
			MaxUniqueItems: proto.Int64(int64(num)),
		}
	}
	_, err := client.CreateSketch(context.Background(), in)
	return err
}