Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 72 for table (0.13 sec)

  1. tests/main_test.go

    	if count1 != count2 {
    		t.Errorf("No user should not be deleted by invalid SQL")
    	}
    }
    
    func TestSetAndGet(t *testing.T) {
    	if value, ok := DB.Set("hello", "world").Get("hello"); !ok {
    		t.Errorf("Should be able to get setting after set")
    	} else if value.(string) != "world" {
    		t.Errorf("Set value should not be changed")
    	}
    
    	if _, ok := DB.Get("non_existing"); ok {
    		t.Errorf("Get non existing key should return error")
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 1.4K bytes
    - Viewed (0)
  2. schema/schema_test.go

    }
    
    type CustomizedNamingStrategy struct {
    	schema.NamingStrategy
    }
    
    func (ns CustomizedNamingStrategy) ColumnName(table, column string) string {
    	baseColumnName := ns.NamingStrategy.ColumnName(table, column)
    
    	if table == "" {
    		return baseColumnName
    	}
    
    	s := strings.Split(table, "_")
    
    	var prefix string
    	switch len(s) {
    	case 1:
    		prefix = s[0][:3]
    	case 2:
    		prefix = s[0][:1] + s[1][:2]
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  3. tests/delete_test.go

    	type UserWithDelete struct {
    		gorm.Model
    		Name string
    	}
    
    	DB.Table("deleted_users").Migrator().DropTable(UserWithDelete{})
    	DB.Table("deleted_users").AutoMigrate(UserWithDelete{})
    
    	user := UserWithDelete{Name: "delete1"}
    	DB.Table("deleted_users").Create(&user)
    
    	var result UserWithDelete
    	if err := DB.Table("deleted_users").First(&result).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 07:03:34 GMT 2023
    - 9.4K bytes
    - Viewed (0)
  4. tests/error_translator_test.go

    	if supported, found := dialectors[db.Dialector.Name()]; !(found && supported) {
    		return
    	}
    
    	DB.Migrator().DropTable(&City{})
    
    	if err = db.AutoMigrate(&City{}); err != nil {
    		t.Fatalf("failed to migrate cities table, got error: %v", err)
    	}
    
    	err = db.Create(&City{Name: "Kabul"}).Error
    	if err != nil {
    		t.Fatalf("failed to create record: %v", err)
    	}
    
    	err = db.Create(&City{Name: "Kabul"}).Error
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 12 13:21:22 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  5. README.md

    ## Overview
    
    * Full-Featured ORM
    * Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism, Single-table inheritance)
    * Hooks (Before/After Create/Save/Update/Delete/Find)
    * Eager loading with `Preload`, `Joins`
    * Transactions, Nested Transactions, Save Point, RollbackTo to Saved Point
    * Context, Prepared Statement Mode, DryRun Mode
    Plain Text
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:20:06 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  6. tests/transaction_test.go

    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	tx2.Commit()
    
    	if err := DB.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
    		t.Fatalf("Should be able to find committed record, but got %v", err)
    	}
    
    	t.Run("this is test nested transaction and prepareStmt coexist case", func(t *testing.T) {
    		// enable prepare statement
    		tx3 := DB.Session(&gorm.Session{PrepareStmt: true})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  7. callbacks/preload.go

    						return err
    					}
    				default:
    					return gorm.ErrInvalidData
    				}
    			} else {
    				tx := db.Table("").Session(&gorm.Session{Context: db.Statement.Context, SkipHooks: db.Statement.SkipHooks})
    				tx.Statement.ReflectValue = db.Statement.ReflectValue
    				tx.Statement.Unscoped = db.Statement.Unscoped
    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)
  8. tests/preload_test.go

    		}
    	}
    
    	CheckUser(t, users2[0], users[0])
    
    	var users3 []User
    	if err := DB.Preload("Account", func(tx *gorm.DB) *gorm.DB {
    		return tx.Table("accounts AS a").Select("a.*")
    	}).Find(&users3, "id IN ?", userIDs).Error; err != nil {
    		t.Errorf("failed to query, got error %v", err)
    	}
    	sort.Slice(users3, func(i, j int) bool {
    		return users2[i].ID < users2[j].ID
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  9. clause/expression_test.go

    		Result: "`table`.`col` AS `alias`",
    	}, {
    		SQL:    "?",
    		Vars:   []interface{}{clause.Column{Table: "table", Name: "col", Alias: "alias", Raw: true}},
    		Result: "table.col AS alias",
    	}, {
    		SQL:    "?",
    		Vars:   []interface{}{clause.Table{Name: "table", Alias: "alias"}},
    		Result: "`table` `alias`",
    	}, {
    		SQL:    "?",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Aug 10 05:34:33 GMT 2023
    - 8.4K bytes
    - Viewed (0)
  10. clause/update.go

    	}
    }
    
    // MergeClause merge update clause
    func (update Update) MergeClause(clause *Clause) {
    	if v, ok := clause.Expression.(Update); ok {
    		if update.Modifier == "" {
    			update.Modifier = v.Modifier
    		}
    		if update.Table.Name == "" {
    			update.Table = v.Table
    		}
    	}
    	clause.Expression = update
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 09 09:07:00 GMT 2020
    - 737 bytes
    - Viewed (0)
Back to top