From 6ee68d0b95a504712d6dab15953c5792425e28ca Mon Sep 17 00:00:00 2001 From: Andrey Chernij Date: Wed, 22 Apr 2020 11:35:30 +0300 Subject: [PATCH 1/2] add support VIRTUAL GENERATED fileds and POINT fields --- schema/schema.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/schema/schema.go b/schema/schema.go index 0c4f6344e..2f497da1b 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -32,6 +32,7 @@ const ( TYPE_JSON // json TYPE_DECIMAL // decimal TYPE_MEDIUM_INT + TYPE_POINT // coordinates ) type TableColumn struct { @@ -41,6 +42,7 @@ type TableColumn struct { RawType string IsAuto bool IsUnsigned bool + IsVirtual bool EnumValues []string SetValues []string } @@ -106,6 +108,8 @@ func (ta *Table) AddColumn(name string, columnType string, collation string, ext ta.Columns[index].Type = TYPE_BIT } else if strings.HasPrefix(columnType, "json") { ta.Columns[index].Type = TYPE_JSON + } else if strings.Contains(columnType, "point") { + ta.Columns[index].Type = TYPE_POINT } else if strings.Contains(columnType, "mediumint") { ta.Columns[index].Type = TYPE_MEDIUM_INT } else if strings.Contains(columnType, "int") || strings.HasPrefix(columnType, "year") { @@ -121,6 +125,8 @@ func (ta *Table) AddColumn(name string, columnType string, collation string, ext if extra == "auto_increment" { ta.Columns[index].IsAuto = true + } else if extra == "VIRTUAL GENERATED" { + ta.Columns[index].IsVirtual = true } } From 35735f225d036d0ec1fe41b4f52bebe0c02ab2c1 Mon Sep 17 00:00:00 2001 From: andreyc21 <30876123+andreyc21@users.noreply.github.com> Date: Fri, 24 Apr 2020 11:24:37 +0300 Subject: [PATCH 2/2] Update schema.go --- schema/schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/schema.go b/schema/schema.go index c25305926..a5e2fa782 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -33,8 +33,8 @@ const ( TYPE_JSON // json TYPE_DECIMAL // decimal TYPE_MEDIUM_INT - TYPE_BINARY // binary, varbinary - TYPE_POINT // coordinates + TYPE_BINARY // binary, varbinary + TYPE_POINT // coordinates ) type TableColumn struct {