// ParseTabletType parses the tablet type into the enum func ParseTabletType(param string) (topodatapb.TabletType, error) { value, ok := topodatapb.TabletType_value[strings.ToUpper(param)] if !ok { return topodatapb.TabletType_UNKNOWN, fmt.Errorf("unknown TabletType %v", param) } return topodatapb.TabletType(value), nil }
// TargetToProto3 transform the bson RPC target to proto3 func TargetToProto3(target *Target) *pb.Target { if target == nil { return nil } return &pb.Target{ Keyspace: target.Keyspace, Shard: target.Shard, TabletType: pbt.TabletType(target.TabletType), } }
// TargetToProto3 transform the bson RPC target to proto3 func TargetToProto3(target *Target) *querypb.Target { if target == nil { return nil } return &querypb.Target{ Keyspace: target.Keyspace, Shard: target.Shard, TabletType: topodatapb.TabletType(target.TabletType), } }
// TabletTypeToProto turns a TabletType into a proto func TabletTypeToProto(t TabletType) pb.TabletType { if result, ok := pb.TabletType_value[strings.ToUpper(string(t))]; ok { return pb.TabletType(result) } panic(fmt.Errorf("unknown tablet type: %v", t)) }