Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 72 for tool (0.16 sec)

  1. tests/helper_test.go

    	}
    
    	for i := 0; i < config.Toys; i++ {
    		user.Toys = append(user.Toys, Toy{Name: name + "_toy_" + strconv.Itoa(i+1)})
    	}
    
    	for i := 0; i < config.Tools; i++ {
    		user.Tools = append(user.Tools, Tools{Name: name + "_tool_" + strconv.Itoa(i+1)})
    	}
    
    	if config.Company {
    		user.Company = Company{Name: "company-" + name}
    	}
    
    	if config.Manager {
    		user.Manager = GetUser(name+"_manager", Config{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  2. scan.go

    		}
    
    		if len(joinFields) == 0 || len(joinFields[idx]) == 0 {
    			db.AddError(field.Set(db.Statement.Context, reflectValue, values[idx]))
    		} else { // joinFields count is larger than 2 when using join
    			var isNilPtrValue bool
    			var relValue reflect.Value
    			// does not contain raw dbname
    			nestedJoinSchemas := joinFields[idx][:len(joinFields[idx])-1]
    			// current reflect value
    			currentReflectValue := reflectValue
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  3. callbacks.go

    	db        *DB
    	Clauses   []string
    	fns       []func(*DB)
    	callbacks []*callback
    }
    
    type callback struct {
    	name      string
    	before    string
    	after     string
    	remove    bool
    	replace   bool
    	match     func(*DB) bool
    	handler   func(*DB)
    	processor *processor
    }
    
    func (cs *callbacks) Create() *processor {
    	return cs.processors["create"]
    }
    
    func (cs *callbacks) Query() *processor {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  4. callbacks/helper_test.go

    package callbacks
    
    import (
    	"reflect"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    )
    
    func TestLoadOrStoreVisitMap(t *testing.T) {
    	var vm visitMap
    	var loaded bool
    	type testM struct {
    		Name string
    	}
    
    	t1 := testM{Name: "t1"}
    	t2 := testM{Name: "t2"}
    	t3 := testM{Name: "t3"}
    
    	vm = make(visitMap)
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  5. tests/associations_has_many_test.go

    	}
    
    	// Find Tools (polymorphic with custom type and id)
    	var tools []Tools
    	DB.Model(&users).Association("Tools").Find(&tools)
    
    	if len(tools) != 2 {
    		t.Errorf("tools count should be %v, but got %v", 2, len(tools))
    	}
    
    	// Append
    	DB.Model(&users).Association("Toys").Append(
    		&Toy{Name: "toy-slice-append-1"},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  6. tests/joins_test.go

    	} else if len(users2) != len(users) {
    		t.Fatalf("Failed to load join users, got: %v, expect: %v", len(users2), len(users))
    	}
    
    	sort.Slice(users2, func(i, j int) bool {
    		return users2[i].ID > users2[j].ID
    	})
    
    	sort.Slice(users, func(i, j int) bool {
    		return users[i].ID > users[j].ID
    	})
    
    	for idx, user := range users {
    		CheckUser(t, user, users2[idx])
    	}
    }
    
    func TestJoinConds(t *testing.T) {
    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)
  7. tests/count_test.go

    		t.Fatalf(fmt.Sprintf("Count should work, but got err %v", err))
    	}
    
    	expects := []User{{Name: "main"}, {Name: "other"}, {Name: "other"}}
    	sort.SliceStable(users, func(i, j int) bool {
    		return strings.Compare(users[i].Name, users[j].Name) < 0
    	})
    
    	AssertEqual(t, users, expects)
    
    	var count7 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)
  8. callbacks/visit_map_test.go

    package callbacks
    
    import (
    	"reflect"
    	"testing"
    )
    
    func TestLoadOrStoreVisitMap(t *testing.T) {
    	var vm visitMap
    	var loaded bool
    	type testM struct {
    		Name string
    	}
    
    	t1 := testM{Name: "t1"}
    	t2 := testM{Name: "t2"}
    	t3 := testM{Name: "t3"}
    
    	vm = make(visitMap)
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
    		t.Fatalf("loaded should be false")
    	}
    
    Go
    - Registered: Sun Feb 25 09:35:10 GMT 2024
    - Last Modified: Thu Mar 17 15:53:31 GMT 2022
    - 780 bytes
    - Viewed (0)
  9. clause/set_test.go

    func TestAssignments(t *testing.T) {
    	set := clause.Assignments(map[string]interface{}{
    		"name": "jinzhu",
    		"age":  18,
    	})
    
    	assignments := []clause.Assignment(set)
    
    	sort.Slice(assignments, func(i, j int) bool {
    		return strings.Compare(assignments[i].Column.Name, assignments[j].Column.Name) > 0
    	})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.4K bytes
    - Viewed (0)
  10. tests/embedded_struct_test.go

    	"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
    		Email string
    	}
    
    	type HNPost struct {
    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)
Back to top