Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for contain (0.17 sec)

  1. scan.go

    			db.AddError(field.Set(db.Statement.Context, reflectValue, values[idx]))
    		} else { // joinFields count is larger than 2 when using join
    			var isNilPtrValue bool
    			var relValue reflect.Value
    			// does not contain raw dbname
    			nestedJoinSchemas := joinFields[idx][:len(joinFields[idx])-1]
    			// current reflect value
    			currentReflectValue := reflectValue
    			fullRels := make([]string, 0, len(nestedJoinSchemas))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  2. tests/create_test.go

    		GetUser("invalid_slice_2", Config{}),
    		nil,
    	}
    
    	if err := DB.Create(&users).Error; !errors.Is(err, gorm.ErrInvalidData) {
    		t.Errorf("should returns error invalid data when creating from slice that contains invalid data")
    	}
    }
    
    func TestCreateWithExistingTimestamp(t *testing.T) {
    	user := User{Name: "CreateUserExistingTimestamp"}
    	curTime := now.MustParse("2016-01-01")
    	user.CreatedAt = curTime
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  3. finisher_api.go

    		tx.RowsAffected = rowsAffected
    	default:
    		tx = db.getInstance()
    		tx.Statement.Dest = value
    		tx = tx.callbacks.Create().Execute(tx)
    	}
    	return
    }
    
    // Save updates value in database. If value doesn't contain a matching primary key, value is inserted.
    func (db *DB) Save(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    
    	reflectValue := reflect.Indirect(reflect.ValueOf(value))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  4. chainable_api.go

    //
    //	// Get a user
    //	db.Table("users").Take(&result)
    func (db *DB) Table(name string, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	if strings.Contains(name, " ") || strings.Contains(name, "`") || len(args) > 0 {
    		tx.Statement.TableExpr = &clause.Expr{SQL: name, Vars: args}
    		if results := tableRegexp.FindStringSubmatch(name); len(results) == 3 {
    			if results[1] != "" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  5. utils/utils.go

    			vv := reflect.ValueOf(v)
    			if vv.IsValid() && !vv.IsZero() {
    				results[idx] = fmt.Sprint(reflect.Indirect(vv).Interface())
    			}
    		}
    	}
    
    	return strings.Join(results, "_")
    }
    
    func Contains(elems []string, elem string) bool {
    	for _, e := range elems {
    		if elem == e {
    			return true
    		}
    	}
    	return false
    }
    
    func AssertEqual(x, y interface{}) bool {
    	if reflect.DeepEqual(x, y) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  6. migrator/migrator.go

    			for _, dbName := range stmt.Schema.DBNames {
    				field := stmt.Schema.FieldsByDBName[dbName]
    				if !field.IgnoreMigration {
    					createTableSQL += "? ?"
    					hasPrimaryKeyInDataType = hasPrimaryKeyInDataType || strings.Contains(strings.ToUpper(m.DataTypeOf(field)), "PRIMARY KEY")
    					values = append(values, clause.Column{Name: dbName}, m.DB.Migrator().FullDataTypeOf(field))
    					createTableSQL += ","
    				}
    			}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  7. callbacks/delete.go

    					return
    				}
    			}
    		}
    
    	}
    }
    
    func Delete(config *Config) func(db *gorm.DB) {
    	supportReturning := utils.Contains(config.DeleteClauses, "RETURNING")
    
    	return func(db *gorm.DB) {
    		if db.Error != nil {
    			return
    		}
    
    		if db.Statement.Schema != nil {
    			for _, c := range db.Statement.Schema.DeleteClauses {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  8. callbacks/create.go

    					called = true
    					db.AddError(i.BeforeCreate(tx))
    				}
    			}
    			return called
    		})
    	}
    }
    
    // Create create hook
    func Create(config *Config) func(db *gorm.DB) {
    	supportReturning := utils.Contains(config.CreateClauses, "RETURNING")
    
    	return func(db *gorm.DB) {
    		if db.Error != nil {
    			return
    		}
    
    		if db.Statement.Schema != nil {
    			if !db.Statement.Unscoped {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  9. tests/migrate_test.go

    						columnType)
    				}
    			case "name":
    				dataType := DB.Dialector.DataTypeOf(stmt.Schema.LookUpField(columnType.Name()))
    				if !strings.Contains(strings.ToUpper(dataType), strings.ToUpper(columnType.DatabaseTypeName())) {
    					t.Fatalf("column name type should be correct, name: %v, length: %v, expects: %v, column: %#v",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  10. schema/utils.go

    	}
    	return tag
    }
    
    func appendSettingFromTag(tag reflect.StructTag, value string) reflect.StructTag {
    	t := tag.Get("gorm")
    	if strings.Contains(t, value) {
    		return tag
    	}
    	return reflect.StructTag(fmt.Sprintf(`gorm:"%s;%s"`, value, t))
    }
    
    // GetRelationsValues get relations's values from a reflect value
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
Back to top