(tablePartition *v1pb.TablePartitionMetadata)
| 1004 | } |
| 1005 | |
| 1006 | func convertV1TablePartitionMetadata(tablePartition *v1pb.TablePartitionMetadata) *storepb.TablePartitionMetadata { |
| 1007 | metadata := &storepb.TablePartitionMetadata{ |
| 1008 | Name: tablePartition.Name, |
| 1009 | Expression: tablePartition.Expression, |
| 1010 | Value: tablePartition.Value, |
| 1011 | UseDefault: tablePartition.UseDefault, |
| 1012 | } |
| 1013 | switch tablePartition.Type { |
| 1014 | case v1pb.TablePartitionMetadata_RANGE: |
| 1015 | metadata.Type = storepb.TablePartitionMetadata_RANGE |
| 1016 | case v1pb.TablePartitionMetadata_RANGE_COLUMNS: |
| 1017 | metadata.Type = storepb.TablePartitionMetadata_RANGE_COLUMNS |
| 1018 | case v1pb.TablePartitionMetadata_LIST: |
| 1019 | metadata.Type = storepb.TablePartitionMetadata_LIST |
| 1020 | case v1pb.TablePartitionMetadata_LIST_COLUMNS: |
| 1021 | metadata.Type = storepb.TablePartitionMetadata_LIST_COLUMNS |
| 1022 | case v1pb.TablePartitionMetadata_HASH: |
| 1023 | metadata.Type = storepb.TablePartitionMetadata_HASH |
| 1024 | case v1pb.TablePartitionMetadata_LINEAR_HASH: |
| 1025 | metadata.Type = storepb.TablePartitionMetadata_LINEAR_HASH |
| 1026 | case v1pb.TablePartitionMetadata_KEY: |
| 1027 | metadata.Type = storepb.TablePartitionMetadata_KEY |
| 1028 | case v1pb.TablePartitionMetadata_LINEAR_KEY: |
| 1029 | metadata.Type = storepb.TablePartitionMetadata_LINEAR_KEY |
| 1030 | default: |
| 1031 | metadata.Type = storepb.TablePartitionMetadata_TYPE_UNSPECIFIED |
| 1032 | } |
| 1033 | for _, index := range tablePartition.Indexes { |
| 1034 | if index == nil { |
| 1035 | continue |
| 1036 | } |
| 1037 | metadata.Indexes = append(metadata.Indexes, convertV1IndexMetadata(index)) |
| 1038 | } |
| 1039 | for _, subpartition := range tablePartition.Subpartitions { |
| 1040 | if subpartition == nil { |
| 1041 | continue |
| 1042 | } |
| 1043 | metadata.Subpartitions = append(metadata.Subpartitions, convertV1TablePartitionMetadata(subpartition)) |
| 1044 | } |
| 1045 | return metadata |
| 1046 | } |
| 1047 | |
| 1048 | func convertV1ColumnMetadata(column *v1pb.ColumnMetadata) *storepb.ColumnMetadata { |
| 1049 | metadata := &storepb.ColumnMetadata{ |
no test coverage detected