Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for SelectAndOmitColumns (0.28 sec)

  1. callbacks/helper.go

    	// when the length of mapValues is zero,return directly here
    	// no need to call stmt.SelectAndOmitColumns method
    	if len(mapValues) == 0 {
    		stmt.AddError(gorm.ErrEmptySlice)
    		return
    	}
    
    	var (
    		result                    = make(map[string][]interface{}, len(mapValues))
    		selectColumns, restricted = stmt.SelectAndOmitColumns(true, false)
    	)
    
    	for idx, mapValue := range mapValues {
    		for k, v := range mapValue {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Apr 14 12:32:57 UTC 2022
    - 3.7K bytes
    - Viewed (0)
  2. callbacks/create.go

    		values = ConvertSliceOfMapToValuesForCreate(stmt, value)
    	case *[]map[string]interface{}:
    		values = ConvertSliceOfMapToValuesForCreate(stmt, *value)
    	default:
    		var (
    			selectColumns, restricted = stmt.SelectAndOmitColumns(true, false)
    			_, updateTrackTime        = stmt.Get("gorm:update_track_time")
    			isZero                    bool
    		)
    		stmt.Settings.Delete("gorm:update_track_time")
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Apr 08 03:29:55 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  3. callbacks/associations.go

    	"gorm.io/gorm/utils"
    )
    
    func SaveBeforeAssociations(create bool) func(db *gorm.DB) {
    	return func(db *gorm.DB) {
    		if db.Error == nil && db.Statement.Schema != nil {
    			selectColumns, restricted := db.Statement.SelectAndOmitColumns(create, !create)
    
    			// Save Belongs To associations
    			for _, rel := range db.Statement.Schema.Relationships.BelongsTo {
    				if v, ok := selectColumns[rel.Name]; (ok && !v) || (!ok && restricted) {
    					continue
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Tue Apr 11 03:06:13 UTC 2023
    - 14.3K bytes
    - Viewed (0)
  4. statement.go

    			columnName := matches[3]
    			if star != "" {
    				return table, star
    			}
    			return table, columnName
    		}
    		return "", ""
    	}
    }()
    
    // SelectAndOmitColumns get select and omit columns, select -> true, omit -> false
    func (stmt *Statement) SelectAndOmitColumns(requireCreate, requireUpdate bool) (map[string]bool, bool) {
    	results := map[string]bool{}
    	notRestricted := false
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 24 09:42:59 UTC 2024
    - 19.9K bytes
    - Viewed (0)
  5. callbacks/query.go

    				} else {
    					clauseSelect.Columns[idx] = clause.Column{Name: name, Raw: true}
    				}
    			}
    		} else if db.Statement.Schema != nil && len(db.Statement.Omits) > 0 {
    			selectColumns, _ := db.Statement.SelectAndOmitColumns(false, false)
    			clauseSelect.Columns = make([]clause.Column, 0, len(db.Statement.Schema.DBNames))
    			for _, dbName := range db.Statement.Schema.DBNames {
    				if v, ok := selectColumns[dbName]; (ok && v) || !ok {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 10.1K bytes
    - Viewed (1)
  6. callbacks/update.go

    			return called
    		})
    	}
    }
    
    // ConvertToAssignments convert to update assignments
    func ConvertToAssignments(stmt *gorm.Statement) (set clause.Set) {
    	var (
    		selectColumns, restricted = stmt.SelectAndOmitColumns(false, true)
    		assignValue               func(field *schema.Field, value interface{})
    	)
    
    	switch stmt.ReflectValue.Kind() {
    	case reflect.Slice, reflect.Array:
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Mar 18 05:44:55 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  7. callbacks/delete.go

    				return true
    			}
    
    			return false
    		})
    	}
    }
    
    func DeleteBeforeAssociations(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil {
    		selectColumns, restricted := db.Statement.SelectAndOmitColumns(true, false)
    		if !restricted {
    			return
    		}
    
    		for column, v := range selectColumns {
    			if !v {
    				continue
    			}
    
    			rel, ok := db.Statement.Schema.Relationships.Relations[column]
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Fri Feb 25 02:48:23 UTC 2022
    - 5.6K bytes
    - Viewed (0)
  8. association.go

    			}
    		}
    	}
    
    	selectedSaveColumns := []string{association.Relationship.Name}
    	omitColumns := []string{}
    	selectColumns, _ := association.DB.Statement.SelectAndOmitColumns(true, false)
    	for name, ok := range selectColumns {
    		columnName := ""
    		if strings.HasPrefix(name, association.Relationship.Name) {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 21.5K bytes
    - Viewed (0)
Back to top