summaryrefslogtreecommitdiffstats
path: root/vendor/xorm.io
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-08-26 23:17:23 -0300
committertechknowlogick <techknowlogick@gitea.io>2019-08-26 22:17:23 -0400
commit5fe2ec264febd6a4112c5f8c72c170f016bdf0c8 (patch)
treebc1261858b8278189d7b30c51faaa9b442245d0d /vendor/xorm.io
parent541fab196f216771a51419a8b8d353694afa6c45 (diff)
downloadgitea-5fe2ec264febd6a4112c5f8c72c170f016bdf0c8.tar.gz
gitea-5fe2ec264febd6a4112c5f8c72c170f016bdf0c8.zip
Retry create issue to cope with duplicate keys (#7898)
* Retry create issue to cope with duplicate keys * Use .SetExpr().Where().Insert()
Diffstat (limited to 'vendor/xorm.io')
-rw-r--r--vendor/xorm.io/core/.drone.yml42
-rw-r--r--vendor/xorm.io/core/README.md4
-rw-r--r--vendor/xorm.io/core/cache.go16
-rw-r--r--vendor/xorm.io/core/column.go4
-rw-r--r--vendor/xorm.io/core/db.go4
-rw-r--r--vendor/xorm.io/core/dialect.go20
-rw-r--r--vendor/xorm.io/core/error.go4
-rw-r--r--vendor/xorm.io/core/filter.go20
-rw-r--r--vendor/xorm.io/core/go.mod8
-rw-r--r--vendor/xorm.io/core/go.sum14
-rw-r--r--vendor/xorm.io/core/ilogger.go4
-rw-r--r--vendor/xorm.io/core/index.go7
-rw-r--r--vendor/xorm.io/core/mapper.go8
-rw-r--r--vendor/xorm.io/core/rows.go2
-rw-r--r--vendor/xorm.io/core/stmt.go1
-rw-r--r--vendor/xorm.io/core/table.go9
-rw-r--r--vendor/xorm.io/core/type.go46
17 files changed, 158 insertions, 55 deletions
diff --git a/vendor/xorm.io/core/.drone.yml b/vendor/xorm.io/core/.drone.yml
new file mode 100644
index 0000000000..1ef2b8134c
--- /dev/null
+++ b/vendor/xorm.io/core/.drone.yml
@@ -0,0 +1,42 @@
+workspace:
+ base: /go
+ path: src/xorm.io/core
+
+clone:
+ git:
+ image: plugins/git:next
+ depth: 50
+ tags: true
+
+matrix:
+ GO_VERSION:
+ - 1.9
+ - 1.10
+ - 1.11
+ - 1.12
+
+pipeline:
+ test:
+ image: golang:${GO_VERSION}
+ environment:
+ GOPROXY: https://goproxy.cn
+ commands:
+ - go get -u golang.org/x/lint/golint
+ - go get -u github.com/stretchr/testify/assert
+ - go get -u github.com/go-xorm/sqlfiddle
+ - go get -u github.com/go-sql-driver/mysql
+ - go get -u github.com/mattn/go-sqlite3
+ - go vet
+ - go test -v -race -coverprofile=coverage.txt -covermode=atomic -dbConn="root:@tcp(mysql:3306)/core_test?charset=utf8mb4"
+ when:
+ event: [ push, tag, pull_request ]
+
+
+services:
+ mysql:
+ image: mysql:5.7
+ environment:
+ - MYSQL_DATABASE=core_test
+ - MYSQL_ALLOW_EMPTY_PASSWORD=yes
+ when:
+ event: [ push, tag, pull_request ] \ No newline at end of file
diff --git a/vendor/xorm.io/core/README.md b/vendor/xorm.io/core/README.md
index 09b72c74b3..c2cedcae8c 100644
--- a/vendor/xorm.io/core/README.md
+++ b/vendor/xorm.io/core/README.md
@@ -1,6 +1,8 @@
Core is a lightweight wrapper of sql.DB.
-[![CircleCI](https://circleci.com/gh/go-xorm/core/tree/master.svg?style=svg)](https://circleci.com/gh/go-xorm/core/tree/master)
+[![Build Status](https://drone.gitea.com/api/badges/xorm/core/status.svg)](https://drone.gitea.com/xorm/core)
+[![](http://gocover.io/_badge/xorm.io/core)](http://gocover.io/xorm.io/core)
+[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/xorm.io/core)
# Open
```Go
diff --git a/vendor/xorm.io/core/cache.go b/vendor/xorm.io/core/cache.go
index dc4992dfb1..982abe6a5f 100644
--- a/vendor/xorm.io/core/cache.go
+++ b/vendor/xorm.io/core/cache.go
@@ -14,19 +14,20 @@ import (
)
const (
- // default cache expired time
+ // CacheExpired is default cache expired time
CacheExpired = 60 * time.Minute
- // not use now
+ // CacheMaxMemory is not use now
CacheMaxMemory = 256
- // evey ten minutes to clear all expired nodes
+ // CacheGcInterval represents interval time to clear all expired nodes
CacheGcInterval = 10 * time.Minute
- // each time when gc to removed max nodes
+ // CacheGcMaxRemoved represents max nodes removed when gc
CacheGcMaxRemoved = 20
)
+// list all the errors
var (
- ErrCacheMiss = errors.New("xorm/cache: key not found.")
- ErrNotStored = errors.New("xorm/cache: not stored.")
+ ErrCacheMiss = errors.New("xorm/cache: key not found")
+ ErrNotStored = errors.New("xorm/cache: not stored")
)
// CacheStore is a interface to store cache
@@ -69,6 +70,7 @@ func decodeIds(s string) ([]PK, error) {
return pks, err
}
+// GetCacheSql returns cacher PKs via SQL
func GetCacheSql(m Cacher, tableName, sql string, args interface{}) ([]PK, error) {
bytes := m.GetIds(tableName, GenSqlKey(sql, args))
if bytes == nil {
@@ -77,6 +79,7 @@ func GetCacheSql(m Cacher, tableName, sql string, args interface{}) ([]PK, error
return decodeIds(bytes.(string))
}
+// PutCacheSql puts cacher SQL and PKs
func PutCacheSql(m Cacher, ids []PK, tableName, sql string, args interface{}) error {
bytes, err := encodeIds(ids)
if err != nil {
@@ -86,6 +89,7 @@ func PutCacheSql(m Cacher, ids []PK, tableName, sql string, args interface{}) er
return nil
}
+// GenSqlKey generates cache key
func GenSqlKey(sql string, args interface{}) string {
return fmt.Sprintf("%v-%v", sql, args)
}
diff --git a/vendor/xorm.io/core/column.go b/vendor/xorm.io/core/column.go
index 40d8f9268d..b5906a9874 100644
--- a/vendor/xorm.io/core/column.go
+++ b/vendor/xorm.io/core/column.go
@@ -73,7 +73,7 @@ func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable
// String generate column description string according dialect
func (col *Column) String(d Dialect) string {
- sql := d.QuoteStr() + col.Name + d.QuoteStr() + " "
+ sql := d.Quote(col.Name) + " "
sql += d.SqlType(col) + " "
@@ -101,7 +101,7 @@ func (col *Column) String(d Dialect) string {
// StringNoPk generate column description string according dialect without primary keys
func (col *Column) StringNoPk(d Dialect) string {
- sql := d.QuoteStr() + col.Name + d.QuoteStr() + " "
+ sql := d.Quote(col.Name) + " "
sql += d.SqlType(col) + " "
diff --git a/vendor/xorm.io/core/db.go b/vendor/xorm.io/core/db.go
index 3e50a14795..4847937c73 100644
--- a/vendor/xorm.io/core/db.go
+++ b/vendor/xorm.io/core/db.go
@@ -15,6 +15,7 @@ import (
)
var (
+ // DefaultCacheSize sets the default cache size
DefaultCacheSize = 200
)
@@ -132,6 +133,7 @@ func (db *DB) Query(query string, args ...interface{}) (*Rows, error) {
return db.QueryContext(context.Background(), query, args...)
}
+// QueryMapContext executes query with parameters via map and context
func (db *DB) QueryMapContext(ctx context.Context, query string, mp interface{}) (*Rows, error) {
query, args, err := MapToSlice(query, mp)
if err != nil {
@@ -140,6 +142,7 @@ func (db *DB) QueryMapContext(ctx context.Context, query string, mp interface{})
return db.QueryContext(ctx, query, args...)
}
+// QueryMap executes query with parameters via map
func (db *DB) QueryMap(query string, mp interface{}) (*Rows, error) {
return db.QueryMapContext(context.Background(), query, mp)
}
@@ -196,6 +199,7 @@ var (
re = regexp.MustCompile(`[?](\w+)`)
)
+// ExecMapContext exec map with context.Context
// insert into (name) values (?)
// insert into (name) values (?name)
func (db *DB) ExecMapContext(ctx context.Context, query string, mp interface{}) (sql.Result, error) {
diff --git a/vendor/xorm.io/core/dialect.go b/vendor/xorm.io/core/dialect.go
index 5d35a4f11d..c166596c6f 100644
--- a/vendor/xorm.io/core/dialect.go
+++ b/vendor/xorm.io/core/dialect.go
@@ -40,9 +40,9 @@ type Dialect interface {
DriverName() string
DataSourceName() string
- QuoteStr() string
IsReserved(string) bool
Quote(string) string
+
AndStr() string
OrStr() string
EqStr() string
@@ -70,8 +70,8 @@ type Dialect interface {
ForUpdateSql(query string) string
- //CreateTableIfNotExists(table *Table, tableName, storeEngine, charset string) error
- //MustDropTable(tableName string) error
+ // CreateTableIfNotExists(table *Table, tableName, storeEngine, charset string) error
+ // MustDropTable(tableName string) error
GetColumns(tableName string) ([]string, map[string]*Column, error)
GetTables() ([]*Table, error)
@@ -85,6 +85,7 @@ func OpenDialect(dialect Dialect) (*DB, error) {
return Open(dialect.DriverName(), dialect.DataSourceName())
}
+// Base represents a basic dialect and all real dialects could embed this struct
type Base struct {
db *DB
dialect Dialect
@@ -172,8 +173,15 @@ func (db *Base) HasRecords(query string, args ...interface{}) (bool, error) {
}
func (db *Base) IsColumnExist(tableName, colName string) (bool, error) {
- query := "SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ?"
- query = strings.Replace(query, "`", db.dialect.QuoteStr(), -1)
+ query := fmt.Sprintf(
+ "SELECT %v FROM %v.%v WHERE %v = ? AND %v = ? AND %v = ?",
+ db.dialect.Quote("COLUMN_NAME"),
+ db.dialect.Quote("INFORMATION_SCHEMA"),
+ db.dialect.Quote("COLUMNS"),
+ db.dialect.Quote("TABLE_SCHEMA"),
+ db.dialect.Quote("TABLE_NAME"),
+ db.dialect.Quote("COLUMN_NAME"),
+ )
return db.HasRecords(query, db.DbName, tableName, colName)
}
@@ -310,7 +318,7 @@ func RegisterDialect(dbName DbType, dialectFunc func() Dialect) {
dialects[strings.ToLower(string(dbName))] = dialectFunc // !nashtsai! allow override dialect
}
-// QueryDialect query if registed database dialect
+// QueryDialect query if registered database dialect
func QueryDialect(dbName DbType) Dialect {
if d, ok := dialects[strings.ToLower(string(dbName))]; ok {
return d()
diff --git a/vendor/xorm.io/core/error.go b/vendor/xorm.io/core/error.go
index 63ea53e466..1fd183483b 100644
--- a/vendor/xorm.io/core/error.go
+++ b/vendor/xorm.io/core/error.go
@@ -7,6 +7,8 @@ package core
import "errors"
var (
- ErrNoMapPointer = errors.New("mp should be a map's pointer")
+ // ErrNoMapPointer represents error when no map pointer
+ ErrNoMapPointer = errors.New("mp should be a map's pointer")
+ // ErrNoStructPointer represents error when no struct pointer
ErrNoStructPointer = errors.New("mp should be a struct's pointer")
)
diff --git a/vendor/xorm.io/core/filter.go b/vendor/xorm.io/core/filter.go
index 6aeed4244c..aeea1223c3 100644
--- a/vendor/xorm.io/core/filter.go
+++ b/vendor/xorm.io/core/filter.go
@@ -19,7 +19,23 @@ type QuoteFilter struct {
}
func (s *QuoteFilter) Do(sql string, dialect Dialect, table *Table) string {
- return strings.Replace(sql, "`", dialect.QuoteStr(), -1)
+ dummy := dialect.Quote("")
+ if len(dummy) != 2 {
+ return sql
+ }
+ prefix, suffix := dummy[0], dummy[1]
+ raw := []byte(sql)
+ for i, cnt := 0, 0; i < len(raw); i = i + 1 {
+ if raw[i] == '`' {
+ if cnt%2 == 0 {
+ raw[i] = prefix
+ } else {
+ raw[i] = suffix
+ }
+ cnt++
+ }
+ }
+ return string(raw)
}
// IdFilter filter SQL replace (id) to primary key column name
@@ -35,7 +51,7 @@ func NewQuoter(dialect Dialect) *Quoter {
}
func (q *Quoter) Quote(content string) string {
- return q.dialect.QuoteStr() + content + q.dialect.QuoteStr()
+ return q.dialect.Quote(content)
}
func (i *IdFilter) Do(sql string, dialect Dialect, table *Table) string {
diff --git a/vendor/xorm.io/core/go.mod b/vendor/xorm.io/core/go.mod
index 2703545e69..2ee3596814 100644
--- a/vendor/xorm.io/core/go.mod
+++ b/vendor/xorm.io/core/go.mod
@@ -2,6 +2,12 @@ module xorm.io/core
require (
github.com/go-sql-driver/mysql v1.4.1
+ github.com/golang/protobuf v1.3.1 // indirect
github.com/mattn/go-sqlite3 v1.10.0
- google.golang.org/appengine v1.4.0 // indirect
+ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 // indirect
+ golang.org/x/net v0.0.0-20190603091049-60506f45cf65 // indirect
+ golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed // indirect
+ golang.org/x/text v0.3.2 // indirect
+ golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468 // indirect
+ google.golang.org/appengine v1.6.0 // indirect
)
diff --git a/vendor/xorm.io/core/go.sum b/vendor/xorm.io/core/go.sum
index 8f20f8bc90..4248a62501 100644
--- a/vendor/xorm.io/core/go.sum
+++ b/vendor/xorm.io/core/go.sum
@@ -1,9 +1,23 @@
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
diff --git a/vendor/xorm.io/core/ilogger.go b/vendor/xorm.io/core/ilogger.go
index 348ab88f4f..0c17750c2a 100644
--- a/vendor/xorm.io/core/ilogger.go
+++ b/vendor/xorm.io/core/ilogger.go
@@ -4,8 +4,10 @@
package core
+// LogLevel defines a log level
type LogLevel int
+// enumerate all LogLevels
const (
// !nashtsai! following level also match syslog.Priority value
LOG_DEBUG LogLevel = iota
@@ -16,7 +18,7 @@ const (
LOG_UNKNOWN
)
-// logger interface
+// ILogger is a logger interface
type ILogger interface {
Debug(v ...interface{})
Debugf(format string, v ...interface{})
diff --git a/vendor/xorm.io/core/index.go b/vendor/xorm.io/core/index.go
index ac97b68505..2915428f26 100644
--- a/vendor/xorm.io/core/index.go
+++ b/vendor/xorm.io/core/index.go
@@ -9,12 +9,13 @@ import (
"strings"
)
+// enumerate all index types
const (
IndexType = iota + 1
UniqueType
)
-// database index
+// Index represents a database index
type Index struct {
IsRegular bool
Name string
@@ -35,7 +36,7 @@ func (index *Index) XName(tableName string) string {
return index.Name
}
-// add columns which will be composite index
+// AddColumn add columns which will be composite index
func (index *Index) AddColumn(cols ...string) {
for _, col := range cols {
index.Cols = append(index.Cols, col)
@@ -65,7 +66,7 @@ func (index *Index) Equal(dst *Index) bool {
return true
}
-// new an index
+// NewIndex new an index object
func NewIndex(name string, indexType int) *Index {
return &Index{true, name, indexType, make([]string, 0)}
}
diff --git a/vendor/xorm.io/core/mapper.go b/vendor/xorm.io/core/mapper.go
index ec44ea0db9..4df05cb8e3 100644
--- a/vendor/xorm.io/core/mapper.go
+++ b/vendor/xorm.io/core/mapper.go
@@ -9,7 +9,7 @@ import (
"sync"
)
-// name translation between struct, fields names and table, column names
+// IMapper represents a name convertation between struct's fields name and table's column name
type IMapper interface {
Obj2Table(string) string
Table2Obj(string) string
@@ -184,7 +184,7 @@ func (mapper GonicMapper) Table2Obj(name string) string {
return string(newstr)
}
-// A GonicMapper that contains a list of common initialisms taken from golang/lint
+// LintGonicMapper is A GonicMapper that contains a list of common initialisms taken from golang/lint
var LintGonicMapper = GonicMapper{
"API": true,
"ASCII": true,
@@ -221,7 +221,7 @@ var LintGonicMapper = GonicMapper{
"XSS": true,
}
-// provide prefix table name support
+// PrefixMapper provides prefix table name support
type PrefixMapper struct {
Mapper IMapper
Prefix string
@@ -239,7 +239,7 @@ func NewPrefixMapper(mapper IMapper, prefix string) PrefixMapper {
return PrefixMapper{mapper, prefix}
}
-// provide suffix table name support
+// SuffixMapper provides suffix table name support
type SuffixMapper struct {
Mapper IMapper
Suffix string
diff --git a/vendor/xorm.io/core/rows.go b/vendor/xorm.io/core/rows.go
index 2b046d84cc..a1e8bfbcde 100644
--- a/vendor/xorm.io/core/rows.go
+++ b/vendor/xorm.io/core/rows.go
@@ -170,7 +170,7 @@ func (rs *Rows) ScanMap(dest interface{}) error {
newDest := make([]interface{}, len(cols))
vvv := vv.Elem()
- for i, _ := range cols {
+ for i := range cols {
newDest[i] = rs.db.reflectNew(vvv.Type().Elem()).Interface()
}
diff --git a/vendor/xorm.io/core/stmt.go b/vendor/xorm.io/core/stmt.go
index 20ee202b9b..8a21541a7b 100644
--- a/vendor/xorm.io/core/stmt.go
+++ b/vendor/xorm.io/core/stmt.go
@@ -11,6 +11,7 @@ import (
"reflect"
)
+// Stmt reprents a stmt objects
type Stmt struct {
*sql.Stmt
db *DB
diff --git a/vendor/xorm.io/core/table.go b/vendor/xorm.io/core/table.go
index d129e60f8b..0a3889e146 100644
--- a/vendor/xorm.io/core/table.go
+++ b/vendor/xorm.io/core/table.go
@@ -9,7 +9,7 @@ import (
"strings"
)
-// database table
+// Table represents a database table
type Table struct {
Name string
Type reflect.Type
@@ -41,6 +41,7 @@ func NewEmptyTable() *Table {
return NewTable("", nil)
}
+// NewTable creates a new Table object
func NewTable(name string, t reflect.Type) *Table {
return &Table{Name: name, Type: t,
columnsSeq: make([]string, 0),
@@ -87,7 +88,7 @@ func (table *Table) GetColumnIdx(name string, idx int) *Column {
return nil
}
-// if has primary key, return column
+// PKColumns reprents all primary key columns
func (table *Table) PKColumns() []*Column {
columns := make([]*Column, len(table.PrimaryKeys))
for i, name := range table.PrimaryKeys {
@@ -117,7 +118,7 @@ func (table *Table) DeletedColumn() *Column {
return table.GetColumn(table.Deleted)
}
-// add a column to table
+// AddColumn adds a column to table
func (table *Table) AddColumn(col *Column) {
table.columnsSeq = append(table.columnsSeq, col.Name)
table.columns = append(table.columns, col)
@@ -148,7 +149,7 @@ func (table *Table) AddColumn(col *Column) {
}
}
-// add an index or an unique to table
+// AddIndex adds an index or an unique to table
func (table *Table) AddIndex(index *Index) {
table.Indexes[index.Name] = index
}
diff --git a/vendor/xorm.io/core/type.go b/vendor/xorm.io/core/type.go
index 8164953602..14d6e12e2f 100644
--- a/vendor/xorm.io/core/type.go
+++ b/vendor/xorm.io/core/type.go
@@ -87,16 +87,16 @@ var (
UniqueIdentifier = "UNIQUEIDENTIFIER"
SysName = "SYSNAME"
- Date = "DATE"
- DateTime = "DATETIME"
- SmallDateTime = "SMALLDATETIME"
- Time = "TIME"
- TimeStamp = "TIMESTAMP"
- TimeStampz = "TIMESTAMPZ"
-
- Decimal = "DECIMAL"
- Numeric = "NUMERIC"
- Money = "MONEY"
+ Date = "DATE"
+ DateTime = "DATETIME"
+ SmallDateTime = "SMALLDATETIME"
+ Time = "TIME"
+ TimeStamp = "TIMESTAMP"
+ TimeStampz = "TIMESTAMPZ"
+
+ Decimal = "DECIMAL"
+ Numeric = "NUMERIC"
+ Money = "MONEY"
SmallMoney = "SMALLMONEY"
Real = "REAL"
@@ -147,19 +147,19 @@ var (
Clob: TEXT_TYPE,
SysName: TEXT_TYPE,
- Date: TIME_TYPE,
- DateTime: TIME_TYPE,
- Time: TIME_TYPE,
- TimeStamp: TIME_TYPE,
- TimeStampz: TIME_TYPE,
- SmallDateTime: TIME_TYPE,
-
- Decimal: NUMERIC_TYPE,
- Numeric: NUMERIC_TYPE,
- Real: NUMERIC_TYPE,
- Float: NUMERIC_TYPE,
- Double: NUMERIC_TYPE,
- Money: NUMERIC_TYPE,
+ Date: TIME_TYPE,
+ DateTime: TIME_TYPE,
+ Time: TIME_TYPE,
+ TimeStamp: TIME_TYPE,
+ TimeStampz: TIME_TYPE,
+ SmallDateTime: TIME_TYPE,
+
+ Decimal: NUMERIC_TYPE,
+ Numeric: NUMERIC_TYPE,
+ Real: NUMERIC_TYPE,
+ Float: NUMERIC_TYPE,
+ Double: NUMERIC_TYPE,
+ Money: NUMERIC_TYPE,
SmallMoney: NUMERIC_TYPE,
Binary: BLOB_TYPE,