aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTing-Wei Lan <tingwei.lan@cobinhood.com>2019-03-26 17:42:02 +0800
committerJhih-Ming Huang <jm.huang@cobinhood.com>2019-05-06 10:44:04 +0800
commit5653b4fd7da9c82542035ed9f4a9c54abff70ae9 (patch)
treec6a47b263189e1e4bb9cbf3db7b28c0a6b7290bb
parentf28f408c6259d7342bcb3aad6a6558db78943cfe (diff)
downloaddexon-5653b4fd7da9c82542035ed9f4a9c54abff70ae9.tar.gz
dexon-5653b4fd7da9c82542035ed9f4a9c54abff70ae9.tar.zst
dexon-5653b4fd7da9c82542035ed9f4a9c54abff70ae9.zip
core: vm: sqlvm: schema: move methods of DataTypeMajor
We will add more methods to DataType.
-rw-r--r--core/vm/sqlvm/ast/types.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/vm/sqlvm/ast/types.go b/core/vm/sqlvm/ast/types.go
index 3909e7575..c37e6c012 100644
--- a/core/vm/sqlvm/ast/types.go
+++ b/core/vm/sqlvm/ast/types.go
@@ -68,6 +68,16 @@ func ComposeDataType(major DataTypeMajor, minor DataTypeMinor) DataType {
return (DataType(major) << 8) | DataType(minor)
}
+// IsFixedRange checks if major is in range of DataTypeMajorFixed.
+func (d DataTypeMajor) IsFixedRange() bool {
+ return d >= DataTypeMajorFixed && d-DataTypeMajorFixed <= 0x1f
+}
+
+// IsUfixedRange checks if major is in range of DataTypeMajorUfixed.
+func (d DataTypeMajor) IsUfixedRange() bool {
+ return d >= DataTypeMajorUfixed && d-DataTypeMajorUfixed <= 0x1f
+}
+
// Size return the bytes of the data type occupied.
func (dt DataType) Size() uint8 {
major, minor := DecomposeDataType(dt)
@@ -91,16 +101,6 @@ func (dt DataType) Size() uint8 {
}
}
-// IsFixedRange checks if major is in range of DataTypeMajorFixed.
-func (d DataTypeMajor) IsFixedRange() bool {
- return d >= DataTypeMajorFixed && d-DataTypeMajorFixed <= 0x1f
-}
-
-// IsUfixedRange checks if major is in range of DataTypeMajorUfixed.
-func (d DataTypeMajor) IsUfixedRange() bool {
- return d >= DataTypeMajorUfixed && d-DataTypeMajorUfixed <= 0x1f
-}
-
// DataTypeEncode encodes data type node into DataType.
func DataTypeEncode(n TypeNode) (DataType, error) {
if n == nil {