Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 33 for or (0.12 sec)

  1. migrator.go

    func (db *DB) AutoMigrate(dst ...interface{}) error {
    	return db.Migrator().AutoMigrate(dst...)
    }
    
    // ViewOption view option
    type ViewOption struct {
    	Replace     bool   // If true, exec `CREATE`. If false, exec `CREATE OR REPLACE`
    	CheckOption string // optional. e.g. `WITH [ CASCADED | LOCAL ] CHECK OPTION`
    	Query       *DB    // required subquery.
    }
    
    // ColumnType column type interface
    type ColumnType interface {
    	Name() string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  2. tests/migrate_test.go

    	}
    
    	type ColumnStruct2 struct {
    		gorm.Model
    		Name         string
    		StringBool   bool // change existing boolean column from string to boolean
    		SmallintBool bool // change existing boolean column from smallint or other to boolean
    	}
    
    	DB.Migrator().DropTable(&ColumnStruct{})
    
    	if err := DB.AutoMigrate(&ColumnStruct{}); err != nil {
    		t.Errorf("Failed to migrate, got %v", err)
    	}
    
    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)
  3. clause/where_test.go

    			[]interface{}{"1", "jinzhu", 18},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Where{
    				Exprs: []clause.Expression{clause.Or(clause.Eq{Column: clause.PrimaryColumn, Value: "1"}), clause.Or(clause.Neq{Column: "name", Value: "jinzhu"})},
    			}},
    			"SELECT * FROM `users` WHERE `users`.`id` = ? OR `name` <> ?",
    			[]interface{}{"1", "jinzhu"},
    		},
    		{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  4. tests/scan_test.go

    	user2 := User{Name: "ScanRowsUser2", Age: 10}
    	user3 := User{Name: "ScanRowsUser3", Age: 20}
    	DB.Save(&user1).Save(&user2).Save(&user3)
    
    	rows, err := DB.Table("users").Where("name = ? or name = ?", user2.Name, user3.Name).Select("name, age").Rows()
    	if err != nil {
    		t.Errorf("Not error should happen, got %v", err)
    	}
    
    	type Result struct {
    		Name string
    		Age  int
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  5. callbacks/callbacks.go

    	createCallback.Register("gorm:save_after_associations", SaveAfterAssociations(true))
    	createCallback.Register("gorm:after_create", AfterCreate)
    	createCallback.Match(enableTransaction).Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction)
    	createCallback.Clauses = config.CreateClauses
    
    	queryCallback := db.Callback().Query()
    	queryCallback.Register("gorm:query", Query)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Oct 27 23:56:55 GMT 2021
    - 3.3K bytes
    - Viewed (0)
  6. callbacks/preload.go

    		names = append(names, embeddedValues(relations)...)
    	}
    	return names
    }
    
    // preloadEntryPoint enters layer by layer. It will call real preload if it finds the right entry point.
    // If the current relationship is embedded or joined, current query will be ignored.
    //
    //nolint:cyclop
    func preloadEntryPoint(db *gorm.DB, joins []string, relationships *schema.Relationships, preloads map[string][]interface{}, associationsConds []interface{}) error {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  7. statement.go

    			}
    		} else {
    			stmt.AddError(ErrInvalidField)
    		}
    	} else {
    		stmt.AddError(ErrInvalidField)
    	}
    }
    
    // Changed check model changed or not when updating
    func (stmt *Statement) Changed(fields ...string) bool {
    	modelValue := stmt.ReflectValue
    	switch modelValue.Kind() {
    	case reflect.Slice, reflect.Array:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  8. tests/sql_builder_test.go

    	if !regexp.MustCompile(`WHERE \(\(a = .+ or b = .+\) OR \(c = .+ and d = .+\) OR \(e = .+ and f = .+\)\) AND .users.\..deleted_at. IS NULL`).MatchString(sql) {
    		t.Fatalf("invalid sql generated, got %v", sql)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  9. clause/where.go

    	}
    }
    
    func Or(exprs ...Expression) Expression {
    	if len(exprs) == 0 {
    		return nil
    	}
    	return OrConditions{Exprs: exprs}
    }
    
    type OrConditions struct {
    	Exprs []Expression
    }
    
    func (or OrConditions) Build(builder Builder) {
    	if len(or.Exprs) > 1 {
    		builder.WriteByte('(')
    		buildExprs(or.Exprs, builder, OrWithSpace)
    		builder.WriteByte(')')
    	} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 5.1K bytes
    - Viewed (0)
  10. tests/query_test.go

    		t.Fatalf("Build OR condition, but got %v", result.Statement.SQL.String())
    	}
    
    	result = dryDB.Where("role = ?", "admin").Where(DB.Or("role = ?", "super_admin").Or("role = ?", "admin")).Find(&User{})
    	if !regexp.MustCompile("SELECT \\* FROM .*users.* WHERE .*role.* = .+ AND (.*role.* = .+ OR .*role.* = .+)").MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("Build OR condition, but got %v", result.Statement.SQL.String())
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top