Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for Assert (0.07 sec)

  1. tests/joins_test.go

    	for i := 0; i < 21; i++ {
    		user := &User{Name: fmt.Sprintf("User%d", i), ManagerID: &manager.ID}
    		DB.Create(user)
    		userIDs = append(userIDs, user.ID)
    	}
    
    	var entries []User
    	assert.NotPanics(t, func() {
    		assert.NoError(t,
    			DB.Debug().Preload("Manager.Team").
    				Joins("Manager.Company").
    				Find(&entries).Error)
    	})
    }
    
    func TestJoinsPreload_Issue7013_RelationEmpty(t *testing.T) {
    	type (
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:52:33 UTC 2024
    - 15K bytes
    - Viewed (0)
  2. tests/sql_builder_test.go

    			Columns: []clause.OrderByColumn{{Column: clause.Column{Name: "id", Raw: true}, Desc: true}},
    		})
    	})
    	assertEqualSQL(t, `SELECT * FROM users ORDER BY id DESC`, sql)
    }
    
    // assertEqualSQL for assert that the sql is equal, this method will ignore quote, and dialect specials.
    func assertEqualSQL(t *testing.T, expected string, actually string) {
    	t.Helper()
    
    	// replace SQL quote, convert into postgresql like ""
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  3. clause/insert.go

    package clause
    
    type Insert struct {
    	Table    Table
    	Modifier string
    }
    
    // Name insert clause name
    func (insert Insert) Name() string {
    	return "INSERT"
    }
    
    // Build build insert clause
    func (insert Insert) Build(builder Builder) {
    	if insert.Modifier != "" {
    		builder.WriteString(insert.Modifier)
    		builder.WriteByte(' ')
    	}
    
    	builder.WriteString("INTO ")
    	if insert.Table.Name == "" {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Mar 09 09:07:00 UTC 2020
    - 767 bytes
    - Viewed (0)
  4. clause/insert_test.go

    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Insert{}},
    			"INSERT INTO `users`", nil,
    		},
    		{
    			[]clause.Interface{clause.Insert{Modifier: "LOW_PRIORITY"}},
    			"INSERT LOW_PRIORITY INTO `users`", nil,
    		},
    		{
    			[]clause.Interface{clause.Insert{Table: clause.Table{Name: "products"}, Modifier: "LOW_PRIORITY"}},
    			"INSERT LOW_PRIORITY INTO `products`", nil,
    		},
    	}
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Jun 02 01:18:01 UTC 2020
    - 737 bytes
    - Viewed (0)
  5. tests/upsert_test.go

    	}
    }
    
    func TestUpsertSlice(t *testing.T) {
    	langs := []Language{
    		{Code: "upsert-slice1", Name: "Upsert-slice1"},
    		{Code: "upsert-slice2", Name: "Upsert-slice2"},
    		{Code: "upsert-slice3", Name: "Upsert-slice3"},
    	}
    	DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&langs)
    
    	var langs2 []Language
    	if err := DB.Find(&langs2, "code LIKE ?", "upsert-slice%").Error; err != nil {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Sep 05 07:39:19 UTC 2022
    - 11.4K bytes
    - Viewed (0)
  6. callbacks/callbacks.go

    package callbacks
    
    import (
    	"gorm.io/gorm"
    )
    
    var (
    	createClauses = []string{"INSERT", "VALUES", "ON CONFLICT"}
    	queryClauses  = []string{"SELECT", "FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", "FOR"}
    	updateClauses = []string{"UPDATE", "SET", "WHERE"}
    	deleteClauses = []string{"DELETE", "FROM", "WHERE"}
    )
    
    type Config struct {
    	LastInsertIDReversed bool
    	CreateClauses        []string
    	QueryClauses         []string
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Oct 27 23:56:55 UTC 2021
    - 3.3K bytes
    - Viewed (0)
  7. tests/connpool_test.go

    	conn := &wrapperConnPool{
    		db: nativeDB,
    		expect: []string{
    			"SELECT VERSION()",
    			"INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)",
    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Feb 06 02:54:40 UTC 2024
    - 5.5K bytes
    - Viewed (0)
  8. tests/table_test.go

    	}
    
    	r = dryDB.Create(&UserWithTable{}).Statement
    	if DB.Dialector.Name() != "sqlite" {
    		if !regexp.MustCompile(`INSERT INTO .gorm.\..user. (.*name.*) VALUES (.*)`).MatchString(r.Statement.SQL.String()) {
    			t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    		}
    	} else {
    		if !regexp.MustCompile(`INSERT INTO .user. (.*name.*) VALUES (.*)`).MatchString(r.Statement.SQL.String()) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sat Mar 09 09:31:28 UTC 2024
    - 10.6K bytes
    - Viewed (0)
  9. callbacks/create.go

    					}
    					db.Statement.AddClause(clause.Returning{Columns: fromColumns})
    				}
    			}
    		}
    
    		if db.Statement.SQL.Len() == 0 {
    			db.Statement.SQL.Grow(180)
    			db.Statement.AddClauseIfNotExists(clause.Insert{})
    			db.Statement.AddClause(ConvertToCreateValues(db.Statement))
    
    			db.Statement.Build(db.Statement.BuildClauses...)
    		}
    
    		isDryRun := !db.DryRun && db.Error == nil
    		if !isDryRun {
    			return
    		}
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Apr 08 03:29:55 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  10. README.md

    * Eager loading with `Preload`, `Joins`
    * Transactions, Nested Transactions, Save Point, RollbackTo to Saved Point
    * Context, Prepared Statement Mode, DryRun Mode
    * Batch Insert, FindInBatches, Find To Map
    * SQL Builder, Upsert, Locking, Optimizer/Index/Comment Hints, NamedArg, Search/Update/Create with SQL Expr
    * Composite Primary Key
    * Auto Migrations
    * Logger
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Nov 07 02:20:06 UTC 2023
    - 1.8K bytes
    - Viewed (0)
Back to top