Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for db (0.16 sec)

  1. scan.go

    				db.Statement.ReflectValue.Set(reflectValue)
    			}
    		case reflect.Struct, reflect.Ptr:
    			if initialized || rows.Next() {
    				db.scanIntoStruct(rows, reflectValue, values, fields, joinFields)
    			}
    		default:
    			db.AddError(rows.Scan(dest))
    		}
    	}
    
    	if err := rows.Err(); err != nil && err != db.Error {
    		db.AddError(err)
    	}
    
    	if db.RowsAffected == 0 && db.Statement.RaiseErrorOnNotFound && db.Error == nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  2. tests/preload_test.go

    		CheckUser(t, u, users[i])
    	}
    
    	var user4 User
    	DB.Delete(&users3[0].Account)
    
    	if err := DB.Preload(clause.Associations).Take(&user4, "id = ?", users3[0].ID).Error; err != nil || user4.Account.ID != 0 {
    		t.Errorf("failed to query, got error %v, account: %#v", err, user4.Account)
    	}
    
    	if err := DB.Preload(clause.Associations, func(tx *gorm.DB) *gorm.DB {
    		return tx.Unscoped()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  3. callbacks/preload.go

    	tx := db.Session(&gorm.Session{Context: db.Statement.Context, NewDB: true, SkipHooks: db.Statement.SkipHooks, Initialized: true})
    	db.Statement.Settings.Range(func(k, v interface{}) bool {
    		tx.Statement.Settings.Store(k, v)
    		return true
    	})
    
    	if err := tx.Statement.Parse(dest); err != nil {
    		tx.AddError(err)
    		return tx
    	}
    	tx.Statement.ReflectValue = reflectValue
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  4. callbacks/create.go

    // BeforeCreate before create hooks
    func BeforeCreate(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeCreate) {
    		callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
    			if db.Statement.Schema.BeforeSave {
    				if i, ok := value.(BeforeSaveInterface); ok {
    					called = true
    					db.AddError(i.BeforeSave(tx))
    				}
    			}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  5. tests/query_test.go

    		ID   ID
    		Name string
    	}
    
    	DB.Migrator().DropTable(&CustomizedTypePrimaryKey{})
    	if err := DB.AutoMigrate(&CustomizedTypePrimaryKey{}); err != nil {
    		t.Fatalf("failed to migrate, got error %v", err)
    	}
    
    	p1 := CustomizedTypePrimaryKey{Name: "p1"}
    	p2 := CustomizedTypePrimaryKey{Name: "p2"}
    	p3 := CustomizedTypePrimaryKey{Name: "p3"}
    	DB.Create(&p1)
    	DB.Create(&p2)
    	DB.Create(&p3)
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
  6. chainable_api.go

    //	func AmountGreaterThan1000(db *gorm.DB) *gorm.DB {
    //	    return db.Where("amount > ?", 1000)
    //	}
    //
    //	func OrderStatus(status []string) func (db *gorm.DB) *gorm.DB {
    //	    return func (db *gorm.DB) *gorm.DB {
    //	        return db.Scopes(AmountGreaterThan1000).Where("status in (?)", status)
    //	    }
    //	}
    //
    //	db.Scopes(AmountGreaterThan1000, OrderStatus([]string{"paid", "shipped"})).Find(&orders)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  7. internal/event/target/postgresql.go

    func (target *PostgreSQLTarget) initPostgreSQL() error {
    	args := target.args
    
    	db, err := sql.Open("postgres", target.connString)
    	if err != nil {
    		return err
    	}
    	target.db = db
    
    	if args.MaxOpenConnections > 0 {
    		// Set the maximum connections limit
    		target.db.SetMaxOpenConns(args.MaxOpenConnections)
    	}
    
    	err = target.db.Ping()
    	if err != nil {
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Wed Apr 24 17:51:07 GMT 2024
    - 13.3K bytes
    - Viewed (0)
  8. .teamcity/src/test/kotlin/PerformanceTestBuildTypeTest.kt

                "\"-Porg.gradle.performance.branchName=%teamcity.build.branch%\"",
                "\"-Porg.gradle.performance.db.url=%performance.db.url%\"",
                "\"-Porg.gradle.performance.db.username=%performance.db.username%\"",
                "-DenableTestDistribution=%enableTestDistribution%",
                "-Dorg.gradle.workers.max=%maxParallelForks%",
    Plain Text
    - Registered: Wed May 01 11:36:15 GMT 2024
    - Last Modified: Wed Apr 24 08:17:56 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  9. migrator/migrator.go

    type GormDataTypeInterface interface {
    	GormDBDataType(*gorm.DB, *schema.Field) string
    }
    
    // RunWithValue run migration with statement value
    func (m Migrator) RunWithValue(value interface{}, fc func(*gorm.Statement) error) error {
    	stmt := &gorm.Statement{DB: m.DB}
    	if m.DB.Statement != nil {
    		stmt.Table = m.DB.Statement.Table
    		stmt.TableExpr = m.DB.Statement.TableExpr
    	}
    
    	if table, ok := value.(string); ok {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  10. tests/default_value_test.go

    		Created time.Time `gorm:"default:2000-01-02"`
    		Enabled bool      `gorm:"default:true"`
    	}
    
    	DB.Migrator().DropTable(&Harumph{})
    
    	if err := DB.AutoMigrate(&Harumph{}); err != nil {
    		t.Fatalf("Failed to migrate with default value, got error: %v", err)
    	}
    
    	harumph := Harumph{Email: "******@****.***"}
    	if err := DB.Create(&harumph).Error; err != nil {
    		t.Fatalf("Failed to create data with default value, got error: %v", err)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 2.3K bytes
    - Viewed (0)
Back to top