Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for needed (0.18 sec)

  1. tests/joins_test.go

    	users := []User{
    		{
    			Name: "nested-joins-1",
    			Manager: &User{
    				Name: "nested-joins-manager-1",
    				Company: Company{
    					Name: "nested-joins-manager-company-1",
    				},
    				NamedPet: &Pet{
    					Name: "nested-joins-manager-namepet-1",
    					Toy: Toy{
    						Name: "nested-joins-manager-namepet-toy-1",
    					},
    				},
    			},
    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)
  2. scan.go

    							}
    						} else {
    							matchedFieldCount[column] = 1
    						}
    					} else if names := utils.SplitNestedRelationName(column); len(names) > 1 { // has nested relation
    						if rel, ok := sch.Relationships.Relations[names[0]]; ok {
    							subNameCount := len(names)
    							// nested relation fields
    							relFields := make([]*schema.Field, 0, subNameCount-1)
    							relFields = append(relFields, rel.Field)
    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. schema/relationship_test.go

    		VisitingAddress Address `gorm:"embedded;embeddedPrefix:visiting_address_"`
    		AddressID       int
    		Address         struct {
    			ID int
    			Address
    		}
    		NestedAddress *NestedAddress `gorm:"embedded;embeddedPrefix:nested_address_"`
    		CountryMixin
    	}
    
    	s, err := schema.Parse(&Org{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Errorf("Failed to parse schema, got error %v", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  4. migrator/migrator.go

    			if length > 0 && field.Size > 0 {
    				alterColumn = true
    			} else {
    				// has size in data type and not equal
    				// Since the following code is frequently called in the for loop, reg optimization is needed here
    				matches2 := regFullDataType.FindAllStringSubmatch(fullDataType, -1)
    				if !field.PrimaryKey &&
    					(len(matches2) == 1 && matches2[0][1] != fmt.Sprint(length) && ok) {
    					alterColumn = true
    				}
    			}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  5. tests/scanner_valuer_test.go

    		*data = []byte(s[3:])
    		return nil
    	}
    
    	return errors.New("Bytes expected")
    }
    
    func (data EncryptedData) Value() (driver.Value, error) {
    	if len(data) > 0 && data[0] == 'x' {
    		// needed to test failures
    		return nil, errors.New("Should not start with 'x'")
    	}
    
    	// prepend asterisks
    	return append([]byte("***"), data...), nil
    }
    
    type Num int64
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  6. callbacks/query.go

    					relation, ok := db.Statement.Schema.Relationships.Relations[join.Name]
    					if ok {
    						isRelations = true
    						relations = append(relations, relation)
    					} else {
    						// handle nested join like "Manager.Company"
    						nestedJoinNames := strings.Split(join.Name, ".")
    						if len(nestedJoinNames) > 1 {
    							isNestedJoin := true
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  7. finisher_api.go

    // they are rolled back.
    func (db *DB) Transaction(fc func(tx *DB) error, opts ...*sql.TxOptions) (err error) {
    	panicked := true
    
    	if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil {
    		// nested transaction
    		if !db.DisableNestedTransaction {
    			err = db.SavePoint(fmt.Sprintf("sp%p", fc)).Error
    			if err != nil {
    				return
    			}
    			defer func() {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  8. tests/transaction_test.go

    		t.Fatalf("Should find saved record")
    	}
    }
    
    func TestNestedTransactionWithBlock(t *testing.T) {
    	var (
    		user  = *GetUser("transaction-nested", Config{})
    		user1 = *GetUser("transaction-nested-1", Config{})
    		user2 = *GetUser("transaction-nested-2", Config{})
    	)
    
    	if err := DB.Transaction(func(tx *gorm.DB) error {
    		tx.Create(&user)
    
    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)
  9. tests/preload_test.go

    	}
    
    	var find1 Value
    	err := DB.Joins("Nested").Joins("Nested.Join").Preload("Nested.Preloads").First(&find1, value1.ID).Error
    	if err != nil {
    		t.Errorf("failed to find value, got err: %v", err)
    	}
    	AssertEqual(t, find1, value1)
    
    	var find2 Value
    	// Joins will automatically add Nested queries.
    	err = DB.Joins("Nested.Join").Preload("Nested.Preloads").First(&find2, value2.ID).Error
    	if err != nil {
    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)
  10. callbacks/preload.go

    package callbacks
    
    import (
    	"fmt"
    	"reflect"
    	"sort"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // parsePreloadMap extracts nested preloads. e.g.
    //
    //	// schema has a "k0" relation and a "k7.k8" embedded relation
    //	parsePreloadMap(schema, map[string][]interface{}{
    //		clause.Associations: {"arg1"},
    //		"k1":                {"arg2"},
    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)
Back to top