MySQL execution and scan support.
This commit is contained in:
parent
5dda5e1e11
commit
bffa102849
34 changed files with 48216 additions and 337 deletions
|
|
@ -27,7 +27,7 @@ func (c ColumnInfo) SqlBuilderColumnType() string {
|
|||
case "date":
|
||||
return "Date"
|
||||
case "timestamp without time zone",
|
||||
"timestamp": //MySQL:
|
||||
"timestamp", "datetime": //MySQL:
|
||||
return "Timestamp"
|
||||
case "timestamp with time zone":
|
||||
return "Timestampz"
|
||||
|
|
@ -40,7 +40,8 @@ func (c ColumnInfo) SqlBuilderColumnType() string {
|
|||
"char", "varchar", "binary", "varbinary",
|
||||
"tinyblob", "blob", "mediumblob", "longblob", "tinytext", "mediumtext", "longtext": // MySQL
|
||||
return "String"
|
||||
case "real", "numeric", "decimal", "double precision", "float":
|
||||
case "real", "numeric", "decimal", "double precision", "float",
|
||||
"double": // MySQL
|
||||
return "Float"
|
||||
default:
|
||||
fmt.Println("Unsupported sql type: " + c.DataType + ", using string column instead for sql builder.")
|
||||
|
|
@ -66,18 +67,19 @@ func (c ColumnInfo) GoBaseType() string {
|
|||
case "bigint":
|
||||
return "int64"
|
||||
case "date", "timestamp without time zone", "timestamp with time zone", "time with time zone", "time without time zone",
|
||||
"timestamp": // MySQL
|
||||
"timestamp", "datetime": // MySQL
|
||||
return "time.Time"
|
||||
case "bytea",
|
||||
"tinyblob", "blob", "mediumblob", "longblob": //MySQL
|
||||
"binary", "varbinary", "tinyblob", "blob", "mediumblob", "longblob": //MySQL
|
||||
return "[]byte"
|
||||
case "text", "character", "character varying", "tsvector", "bit", "bit varying", "money", "json", "jsonb",
|
||||
"xml", "point", "interval", "line", "ARRAY",
|
||||
"char", "varchar", "binary", "varbinary", "tinytext", "mediumtext", "longtext": // MySQL
|
||||
"char", "varchar", "tinytext", "mediumtext", "longtext": // MySQL
|
||||
return "string"
|
||||
case "real":
|
||||
return "float32"
|
||||
case "numeric", "decimal", "double precision":
|
||||
case "numeric", "decimal", "double precision", "float",
|
||||
"double": // MySQL
|
||||
return "float64"
|
||||
case "uuid":
|
||||
return "uuid.UUID"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package metadata
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
@ -122,8 +121,6 @@ func (m *MySqlQuerySet) GetEnumsMetaData(db *sql.DB, schemaName string) ([]MetaD
|
|||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Println(enumValues)
|
||||
|
||||
enumValues = strings.Replace(enumValues[1:len(enumValues)-1], "'", "", -1)
|
||||
|
||||
ret = append(ret, EnumInfo{
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ func GetSchemaInfo(db *sql.DB, schemaName string, querySet MetaDataQuerySet) (sc
|
|||
|
||||
func getTableInfos(db *sql.DB, querySet MetaDataQuerySet, schemaName string) ([]MetaData, error) {
|
||||
|
||||
fmt.Println(querySet.ListOfTablesQuery())
|
||||
|
||||
rows, err := db.Query(querySet.ListOfTablesQuery(), schemaName)
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -51,8 +49,6 @@ func getTableInfos(db *sql.DB, querySet MetaDataQuerySet, schemaName string) ([]
|
|||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Println(tableName)
|
||||
|
||||
tableInfo, err := GetTableInfo(db, querySet, schemaName, tableName)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue