Skip to content

Commit

Permalink
support regex
Browse files Browse the repository at this point in the history
  • Loading branch information
danielxiaoran committed Sep 29, 2018
1 parent 860bd84 commit f723d43
Show file tree
Hide file tree
Showing 6 changed files with 882 additions and 793 deletions.
14 changes: 14 additions & 0 deletions tablestore/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,26 @@ type ColumnFilter interface {
ToFilter() *otsprotocol.Filter
}

type VariantType int32
const (
Variant_INTEGER VariantType = 0;
Variant_DOUBLE VariantType = 1;
//VT_BOOLEAN = 2;
Variant_STRING VariantType = 3;
)

type ValueTransferRule struct {
Regex string
Cast_type VariantType
}

type SingleColumnCondition struct {
Comparator *ComparatorType
ColumnName *string
ColumnValue interface{} //[]byte
FilterIfMissing bool
LatestVersionOnly bool
TransferRule *ValueTransferRule
}

type ReturnType int32
Expand Down
182 changes: 133 additions & 49 deletions tablestore/otsprotocol/ots_filter.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tablestore/otsprotocol/ots_filter.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
syntax = "proto2";
package otsprotocol;

enum VariantType {
VT_INTEGER = 0;
VT_DOUBLE = 1;
//VT_BOOLEAN = 2;
VT_STRING = 3;
VT_NULL = 6;
VT_BLOB = 7;
}

message ValueTransferRule {
required string regex = 1;
optional VariantType cast_type = 2;
}

enum FilterType {
FT_SINGLE_COLUMN_VALUE = 1;
FT_COMPOSITE_COLUMN_VALUE = 2;
Expand All @@ -22,6 +36,7 @@ message SingleColumnValueFilter {
required bytes column_value = 3; // Serialized SQLVariant
required bool filter_if_missing = 4;
required bool latest_version_only = 5;
optional ValueTransferRule value_trans_rule = 6;
}

enum LogicalOperator {
Expand Down
Loading

0 comments on commit f723d43

Please sign in to comment.