Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for valides (2.18 sec)

  1. clause/values_test.go

    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{
    				clause.Insert{},
    				clause.Values{
    					Columns: []clause.Column{{Name: "name"}, {Name: "age"}},
    					Values:  [][]interface{}{{"jinzhu", 18}, {"josh", 1}},
    				},
    			},
    			"INSERT INTO `users` (`name`,`age`) VALUES (?,?),(?,?)",
    			[]interface{}{"jinzhu", 18, "josh", 1},
    		},
    	}
    
    	for idx, result := range results {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 691 bytes
    - Viewed (0)
  2. soft_delete.go

    			_, queryValues := schema.GetIdentityFieldValuesMap(stmt.Context, stmt.ReflectValue, stmt.Schema.PrimaryFields)
    			column, values := schema.ToQueryValues(stmt.Table, stmt.Schema.PrimaryFieldDBNames, queryValues)
    
    			if len(values) > 0 {
    				stmt.AddClause(clause.Where{Exprs: []clause.Expression{clause.IN{Column: column, Values: values}}})
    			}
    
    			if stmt.ReflectValue.CanAddr() && stmt.Dest != stmt.Model && stmt.Model != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  3. clause/set.go

    	clause.Expression = Set(copiedAssignments)
    }
    
    func Assignments(values map[string]interface{}) Set {
    	keys := make([]string, 0, len(values))
    	for key := range values {
    		keys = append(keys, key)
    	}
    	sort.Strings(keys)
    
    	assignments := make([]Assignment, len(keys))
    	for idx, key := range keys {
    		assignments[idx] = Assignment{Column: Column{Name: key}, Value: values[key]}
    	}
    	return assignments
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Nov 29 03:02:44 GMT 2021
    - 1.4K bytes
    - Viewed (0)
  4. migrator/migrator.go

    			return err
    		}
    	}
    	return nil
    }
    
    // DropTable drop table for values
    func (m Migrator) DropTable(values ...interface{}) error {
    	values = m.ReorderModels(values, false)
    	for i := len(values) - 1; i >= 0; i-- {
    		tx := m.DB.Session(&gorm.Session{})
    		if err := m.RunWithValue(values[i], func(stmt *gorm.Statement) error {
    			return tx.Exec("DROP TABLE IF EXISTS ?", m.CurrentTable(stmt)).Error
    		}); err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  5. callbacks/create_test.go

    		ReflectValue: reflect.ValueOf(dest),
    		Dest:         dest,
    	}
    
    	stmt.Schema = s
    
    	values := ConvertToCreateValues(stmt)
    	expected := clause.Values{
    		// column has value + defaultValue column has value (which should have a stable order)
    		Columns: []clause.Column{{Name: "name"}, {Name: "email"}, {Name: "age"}, {Name: "id"}},
    		Values: [][]interface{}{
    			{"alice", "email", 18, 1},
    			{"bob", "email", 19, 2},
    		},
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  6. clause/expression.go

    		}
    	}
    }
    
    // IN Whether a value is within a set of values
    type IN struct {
    	Column interface{}
    	Values []interface{}
    }
    
    func (in IN) Build(builder Builder) {
    	builder.WriteQuoted(in.Column)
    
    	switch len(in.Values) {
    	case 0:
    		builder.WriteString(" IN (NULL)")
    	case 1:
    		if _, ok := in.Values[0].([]interface{}); !ok {
    			builder.WriteString(" = ")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:45:48 GMT 2023
    - 8.3K bytes
    - Viewed (0)
  7. tests/hooks_test.go

    	}
    
    	DB.Where("Code = ?", "unique_code").First(&p)
    	if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 1, 0, 1, 0, 0, 0, 0, 1}) {
    		t.Fatalf("After callbacks values are not saved, %v", p.GetCallTimes())
    	}
    
    	p.Price = 200
    	DB.Save(&p)
    	if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 2, 1, 1, 1, 1, 0, 0, 1}) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  8. callbacks/associations.go

    		tx = tx.Omit(omits...)
    	}
    
    	return db.AddError(tx.Create(values).Error)
    }
    
    // check association values has been saved
    // if values kind is Struct, check it has been saved
    // if values kind is Slice/Array, check all items have been saved
    var visitMapStoreKey = "gorm:saved_association_map"
    
    func checkAssociationsSaved(db *gorm.DB, values reflect.Value) bool {
    	if visit, ok := db.Get(visitMapStoreKey); ok {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  9. utils/utils.go

    	for _, val := range vals {
    		if val != "" && !strings.EqualFold(val, "false") {
    			return true
    		}
    	}
    	return false
    }
    
    func ToStringKey(values ...interface{}) string {
    	results := make([]string, len(values))
    
    	for idx, value := range values {
    		if valuer, ok := value.(driver.Valuer); ok {
    			value, _ = valuer.Value()
    		}
    
    		switch v := value.(type) {
    		case string:
    			results[idx] = v
    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)
  10. migrator/index.go

    func (idx Index) PrimaryKey() (isPrimaryKey bool, ok bool) {
    	return idx.PrimaryKeyValue.Bool, idx.PrimaryKeyValue.Valid
    }
    
    // Unique returns whether the index is unique or not.
    func (idx Index) Unique() (unique bool, ok bool) {
    	return idx.UniqueValue.Bool, idx.UniqueValue.Valid
    }
    
    // Option return the optional attribute of the index
    func (idx Index) Option() string {
    	return idx.OptionValue
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 02:32:46 GMT 2023
    - 1023 bytes
    - Viewed (0)
Back to top