mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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:
		
							
								
								
									
										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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user