forked from forgejo/forgejo
Update xorm and dependencies vendor for feature to dump to other database (#565)
* update xorm and dependencies vendor for feature to dump to other database * fix golint
This commit is contained in:
parent
70900bd167
commit
980dd0bf51
54 changed files with 3135 additions and 2619 deletions
29
vendor/github.com/go-xorm/xorm/helpers.go
generated
vendored
29
vendor/github.com/go-xorm/xorm/helpers.go
generated
vendored
|
@ -490,9 +490,8 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
|||
args := make([]interface{}, 0, len(table.ColumnsSeq()))
|
||||
|
||||
for _, col := range table.Columns() {
|
||||
lColName := strings.ToLower(col.Name)
|
||||
if useCol && !col.IsVersion && !col.IsCreated && !col.IsUpdated {
|
||||
if _, ok := session.Statement.columnMap[lColName]; !ok {
|
||||
if _, ok := getFlagForColumn(session.Statement.columnMap, col); !ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -528,18 +527,18 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
|||
}
|
||||
|
||||
if session.Statement.ColumnStr != "" {
|
||||
if _, ok := session.Statement.columnMap[lColName]; !ok {
|
||||
if _, ok := getFlagForColumn(session.Statement.columnMap, col); !ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if session.Statement.OmitStr != "" {
|
||||
if _, ok := session.Statement.columnMap[lColName]; ok {
|
||||
if _, ok := getFlagForColumn(session.Statement.columnMap, col); ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// !evalphobia! set fieldValue as nil when column is nullable and zero-value
|
||||
if _, ok := session.Statement.nullableMap[lColName]; ok {
|
||||
if _, ok := getFlagForColumn(session.Statement.nullableMap, col); ok {
|
||||
if col.Nullable && isZero(fieldValue.Interface()) {
|
||||
var nilValue *int
|
||||
fieldValue = reflect.ValueOf(nilValue)
|
||||
|
@ -578,3 +577,23 @@ func genCols(table *core.Table, session *Session, bean interface{}, useCol bool,
|
|||
func indexName(tableName, idxName string) string {
|
||||
return fmt.Sprintf("IDX_%v_%v", tableName, idxName)
|
||||
}
|
||||
|
||||
func getFlagForColumn(m map[string]bool, col *core.Column) (val bool, has bool) {
|
||||
|
||||
if len(m) == 0 {
|
||||
return false, false
|
||||
}
|
||||
|
||||
n := len(col.Name)
|
||||
|
||||
for mk := range m {
|
||||
if len(mk) != n {
|
||||
continue
|
||||
}
|
||||
if strings.EqualFold(mk, col.Name) {
|
||||
return m[mk], true
|
||||
}
|
||||
}
|
||||
|
||||
return false, false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue