update latest xorm version to vendor (#2353)

This commit is contained in:
Lunny Xiao 2017-08-22 19:39:52 +08:00 committed by Lauris BH
parent 5c29b0a5fe
commit 2c6a0fdca8
44 changed files with 1748 additions and 1414 deletions

View file

@ -13,12 +13,13 @@ const (
ONLYFROMDB
)
// database column
// Column defines database column
type Column struct {
Name string
TableName string
FieldName string
SQLType SQLType
IsJSON bool
Length int
Length2 int
Nullable bool
@ -37,6 +38,7 @@ type Column struct {
SetOptions map[string]int
DisableTimeZone bool
TimeZone *time.Location // column specified time zone
Comment string
}
func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable bool) *Column {
@ -60,6 +62,7 @@ func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable
IsVersion: false,
DefaultIsEmpty: false,
EnumOptions: make(map[string]int),
Comment: "",
}
}

View file

@ -244,6 +244,9 @@ func (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset stri
sql += col.StringNoPk(b.dialect)
}
sql = strings.TrimSpace(sql)
if b.DriverName() == MYSQL && len(col.Comment) > 0 {
sql += " COMMENT '" + col.Comment + "'"
}
sql += ", "
}

View file

@ -247,6 +247,18 @@ type Row struct {
err error // deferred error for easy chaining
}
// ErrorRow return an error row
func ErrorRow(err error) *Row {
return &Row{
err: err,
}
}
// NewRow from rows
func NewRow(rows *Rows, err error) *Row {
return &Row{rows, err}
}
func (row *Row) Columns() ([]string, error) {
if row.err != nil {
return nil, row.err

View file

@ -22,6 +22,7 @@ type Table struct {
Cacher Cacher
StoreEngine string
Charset string
Comment string
}
func (table *Table) Columns() []*Column {