Skip to content

Commit 4e4aae4

Browse files
andreyc21Andrey Chernij
and
Andrey Chernij
authored
add support VIRTUAL GENERATED fileds and POINT fields (go-mysql-org#493)
* add support VIRTUAL GENERATED fileds and POINT fields Co-authored-by: Andrey Chernij <[email protected]>
1 parent 0027453 commit 4e4aae4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

schema/schema.go

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
TYPE_DECIMAL // decimal
3535
TYPE_MEDIUM_INT
3636
TYPE_BINARY // binary, varbinary
37+
TYPE_POINT // coordinates
3738
)
3839

3940
type TableColumn struct {
@@ -43,6 +44,7 @@ type TableColumn struct {
4344
RawType string
4445
IsAuto bool
4546
IsUnsigned bool
47+
IsVirtual bool
4648
EnumValues []string
4749
SetValues []string
4850
FixedSize uint
@@ -118,6 +120,8 @@ func (ta *Table) AddColumn(name string, columnType string, collation string, ext
118120
ta.Columns[index].Type = TYPE_BIT
119121
} else if strings.HasPrefix(columnType, "json") {
120122
ta.Columns[index].Type = TYPE_JSON
123+
} else if strings.Contains(columnType, "point") {
124+
ta.Columns[index].Type = TYPE_POINT
121125
} else if strings.Contains(columnType, "mediumint") {
122126
ta.Columns[index].Type = TYPE_MEDIUM_INT
123127
} else if strings.Contains(columnType, "int") || strings.HasPrefix(columnType, "year") {
@@ -139,6 +143,8 @@ func (ta *Table) AddColumn(name string, columnType string, collation string, ext
139143

140144
if extra == "auto_increment" {
141145
ta.Columns[index].IsAuto = true
146+
} else if extra == "VIRTUAL GENERATED" {
147+
ta.Columns[index].IsVirtual = true
142148
}
143149
}
144150

0 commit comments

Comments
 (0)