Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 93 for testis (0.31 sec)

  1. tests/benchmark_test.go

    package tests_test
    
    import (
    	"fmt"
    	"testing"
    
    	. "gorm.io/gorm/utils/tests"
    )
    
    func BenchmarkCreate(b *testing.B) {
    	user := *GetUser("bench", Config{})
    
    	for x := 0; x < b.N; x++ {
    		user.ID = 0
    		DB.Create(&user)
    	}
    }
    
    func BenchmarkFind(b *testing.B) {
    	user := *GetUser("find", Config{})
    	DB.Create(&user)
    
    	for x := 0; x < b.N; x++ {
    		DB.Find(&User{}, "id = ?", user.ID)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 01 03:50:57 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  2. tests/connpool_test.go

    package tests_test
    
    import (
    	"context"
    	"database/sql"
    	"os"
    	"reflect"
    	"testing"
    
    	"gorm.io/driver/mysql"
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type wrapperTx struct {
    	*sql.Tx
    	conn *wrapperConnPool
    }
    
    func (c *wrapperTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.PrepareContext(ctx, query)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  3. tests/count_test.go

    package tests_test
    
    import (
    	"fmt"
    	"regexp"
    	"sort"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCountWithGroup(t *testing.T) {
    	DB.Create([]Company{
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_b"},
    		{Name: "company_count_group_c"},
    	})
    
    	var count1 int64
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  4. tests/named_argument_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"errors"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestNamedArg(t *testing.T) {
    	type NamedUser struct {
    		gorm.Model
    		Name1 string
    		Name2 string
    		Name3 string
    	}
    
    	DB.Migrator().DropTable(&NamedUser{})
    	DB.AutoMigrate(&NamedUser{})
    
    	namedUser := NamedUser{Name1: "jinzhu1", Name2: "jinzhu2", Name3: "jinzhu3"}
    	DB.Create(&namedUser)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Dec 21 11:50:00 GMT 2021
    - 2.7K bytes
    - Viewed (0)
  5. tests/prepared_stmt_test.go

    package tests_test
    
    import (
    	"context"
    	"errors"
    	"sync"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestPreparedStmt(t *testing.T) {
    	tx := DB.Session(&gorm.Session{PrepareStmt: true})
    
    	if _, ok := tx.ConnPool.(*gorm.PreparedStmtDB); !ok {
    		t.Fatalf("should assign PreparedStatement Manager back to database when using PrepareStmt mode")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  6. tests/soft_delete_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"encoding/json"
    	"errors"
    	"regexp"
    	"testing"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestSoftDelete(t *testing.T) {
    	user := *GetUser("SoftDelete", Config{})
    	DB.Save(&user)
    
    	var count int64
    	var age uint
    
    	if DB.Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  7. tests/embedded_struct_test.go

    package tests_test
    
    import (
    	"database/sql/driver"
    	"encoding/json"
    	"errors"
    	"reflect"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestEmbeddedStruct(t *testing.T) {
    	type ReadOnly struct {
    		ReadOnly *bool
    	}
    
    	type BasePost struct {
    		Id    int64
    		Title string
    		URL   string
    		ReadOnly
    	}
    
    	type Author struct {
    		ID    string
    		Name  string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  8. tests/update_has_one_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateHasOne(t *testing.T) {
    	user := *GetUser("update-has-one", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Account = Account{Number: "account-has-one-association"}
    
    	if err := DB.Save(&user).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 3.6K bytes
    - Viewed (0)
  9. tests/joins_test.go

    package tests_test
    
    import (
    	"regexp"
    	"sort"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestJoins(t *testing.T) {
    	user := *GetUser("joins-1", Config{Company: true, Manager: true, Account: true, NamedPet: false})
    
    	DB.Create(&user)
    
    	var user2 User
    	if err := DB.Joins("NamedPet").Joins("Company").Joins("Manager").Joins("Account").First(&user2, "users.name = ?", user.Name).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  10. tests/create_test.go

    package tests_test
    
    import (
    	"errors"
    	"fmt"
    	"regexp"
    	"testing"
    	"time"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCreate(t *testing.T) {
    	user := *GetUser("create", Config{})
    
    	if results := DB.Create(&user); results.Error != nil {
    		t.Fatalf("errors happened when create: %v", results.Error)
    	} else if results.RowsAffected != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
Back to top