aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/vm/sqlvm/schema/schema.go20
-rw-r--r--core/vm/sqlvm/schema/schema_test.go2
2 files changed, 17 insertions, 5 deletions
diff --git a/core/vm/sqlvm/schema/schema.go b/core/vm/sqlvm/schema/schema.go
index 4529fd7d5..76c843387 100644
--- a/core/vm/sqlvm/schema/schema.go
+++ b/core/vm/sqlvm/schema/schema.go
@@ -27,6 +27,18 @@ const (
ColumnAttrHasForeignKey
)
+// TableRef defines the type for table index in Schema.
+type TableRef uint8
+
+// ColumnRef defines the type for column index in Table.Columns.
+type ColumnRef uint8
+
+// IndexRef defines the type for array index of Column.Indices.
+type IndexRef uint8
+
+// SequenceRef defines the type for sequence index in Table.
+type SequenceRef uint8
+
// IndexAttr defines bit flags for describing index attribute.
type IndexAttr uint16
@@ -49,16 +61,16 @@ type Table struct {
type Index struct {
Name []byte
Attr IndexAttr
- Columns []uint8
+ Columns []ColumnRef
}
type column struct {
Name []byte
Type ast.DataType
Attr ColumnAttr
- Sequence uint8
- ForeignTable uint8
- ForeignColumn uint8
+ Sequence SequenceRef
+ ForeignTable TableRef
+ ForeignColumn ColumnRef
Rest interface{}
}
diff --git a/core/vm/sqlvm/schema/schema_test.go b/core/vm/sqlvm/schema/schema_test.go
index 92bfa6c91..5d252ef85 100644
--- a/core/vm/sqlvm/schema/schema_test.go
+++ b/core/vm/sqlvm/schema/schema_test.go
@@ -82,7 +82,7 @@ func (s *SchemaTestSuite) TestEncodeAndDecodeSchema() {
{
Name: []byte("idx"),
Attr: IndexAttrUnique,
- Columns: []uint8{0},
+ Columns: []ColumnRef{0},
},
},
},