Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 86 for Testing (0.18 sec)

  1. schema/schema_helper_test.go

    package schema_test
    
    import (
    	"context"
    	"fmt"
    	"reflect"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    func checkSchema(t *testing.T, s *schema.Schema, v schema.Schema, primaryFields []string) {
    	t.Run("CheckSchema/"+s.Name, func(t *testing.T) {
    		tests.AssertObjEqual(t, s, v, "Name", "Table")
    
    		for idx, field := range primaryFields {
    			var found bool
    			for _, f := range s.PrimaryFields {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  2. clause/select_test.go

    package clause_test
    
    import (
    	"fmt"
    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestSelect(t *testing.T) {
    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}},
    			"SELECT * FROM `users`", nil,
    		},
    		{
    			[]clause.Interface{clause.Select{
    				Columns: []clause.Column{clause.PrimaryColumn},
    			}, clause.From{}},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:06:43 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  3. tests/postgres_test.go

    package tests_test
    
    import (
    	"testing"
    	"time"
    
    	"github.com/google/uuid"
    	"github.com/lib/pq"
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestPostgresReturningIDWhichHasStringType(t *testing.T) {
    	if DB.Dialector.Name() != "postgres" {
    		t.Skip()
    	}
    
    	type Yasuo struct {
    		ID        string `gorm:"default:gen_random_uuid()"`
    		Name      string
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  4. clause/benchmarks_test.go

    package clause_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    func BenchmarkSelect(b *testing.B) {
    	user, _ := schema.Parse(&tests.User{}, &sync.Map{}, db.NamingStrategy)
    
    	for i := 0; i < b.N; i++ {
    		stmt := gorm.Statement{DB: db, Table: user.Table, Schema: user, Clauses: map[string]clause.Clause{}}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Oct 07 12:14:14 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  5. tests/scopes_test.go

    package tests_test
    
    import (
    	"context"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func NameIn1And2(d *gorm.DB) *gorm.DB {
    	return d.Where("name in (?)", []string{"ScopeUser1", "ScopeUser2"})
    }
    
    func NameIn2And3(d *gorm.DB) *gorm.DB {
    	return d.Where("name in (?)", []string{"ScopeUser2", "ScopeUser3"})
    }
    
    func NameIn(names []string) func(d *gorm.DB) *gorm.DB {
    	return func(d *gorm.DB) *gorm.DB {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  6. tests/callbacks_test.go

    package tests_test
    
    import (
    	"fmt"
    	"reflect"
    	"runtime"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm"
    )
    
    func assertCallbacks(v interface{}, fnames []string) (result bool, msg string) {
    	var (
    		got   []string
    		funcs = reflect.ValueOf(v).Elem().FieldByName("fns")
    	)
    
    	for i := 0; i < funcs.Len(); i++ {
    		got = append(got, getFuncName(funcs.Index(i)))
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  7. tests/upsert_test.go

    package tests_test
    
    import (
    	"regexp"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpsert(t *testing.T) {
    	lang := Language{Code: "upsert", Name: "Upsert"}
    	if err := DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&lang).Error; err != nil {
    		t.Fatalf("failed to upsert, got %v", err)
    	}
    
    	lang2 := Language{Code: "upsert", Name: "Upsert"}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  8. callbacks/create_test.go

    package callbacks
    
    import (
    	"reflect"
    	"sync"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    )
    
    var schemaCache = &sync.Map{}
    
    func TestConvertToCreateValues_DestType_Slice(t *testing.T) {
    	type user struct {
    		ID    int `gorm:"primaryKey"`
    		Name  string
    		Email string `gorm:"default:(-)"`
    		Age   int    `gorm:"default:(-)"`
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  9. tests/hooks_test.go

    package tests_test
    
    import (
    	"errors"
    	"reflect"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type Product struct {
    	gorm.Model
    	Name                  string
    	Code                  string
    	Price                 float64
    	AfterFindCallTimes    int64
    	BeforeCreateCallTimes int64
    	AfterCreateCallTimes  int64
    	BeforeUpdateCallTimes int64
    	AfterUpdateCallTimes  int64
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  10. tests/distinct_test.go

    package tests_test
    
    import (
    	"regexp"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestDistinct(t *testing.T) {
    	users := []User{
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct-2", Config{}),
    		*GetUser("distinct-3", Config{}),
    	}
    	users[0].Age = 20
    
    	if err := DB.Create(&users).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
Back to top