Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 68 for couldn (0.14 sec)

  1. callbacks/preload.go

    		if len(joinForeignValues) == 0 {
    			return nil
    		}
    
    		joinResults := rel.JoinTable.MakeSlice().Elem()
    		column, values := schema.ToQueryValues(clause.CurrentTable, joinForeignKeys, joinForeignValues)
    		if err := tx.Where(clause.IN{Column: column, Values: values}).Find(joinResults.Addr().Interface()).Error; err != nil {
    			return err
    		}
    
    		// convert join identity map to relation identity map
    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)
  2. statement_test.go

    		"`User__Company`.*":  {"User__Company", "*"},
    		`"User__Company".*`:  {"User__Company", "*"},
    		`"table"."*"`:        {"", ""},
    	} {
    		if table, column := matchName(k); table != v[0] || column != v[1] {
    			t.Errorf("failed to match value: %v, got %v, expect: %v", k, []string{table, column}, v)
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Dec 23 13:19:41 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  3. tests/error_translator_test.go

    package tests_test
    
    import (
    	"errors"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/utils/tests"
    )
    
    func TestDialectorWithErrorTranslatorSupport(t *testing.T) {
    	// it shouldn't translate error when the TranslateError flag is false
    	translatedErr := errors.New("translated error")
    	untranslatedErr := errors.New("some random error")
    	db, _ := gorm.Open(tests.DummyDialector{TranslatedErr: translatedErr})
    
    	err := db.AddError(untranslatedErr)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 12 13:21:22 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  4. schema/schema_test.go

    			}
    		})
    	}
    }
    
    type CustomizedNamingStrategy struct {
    	schema.NamingStrategy
    }
    
    func (ns CustomizedNamingStrategy) ColumnName(table, column string) string {
    	baseColumnName := ns.NamingStrategy.ColumnName(table, column)
    
    	if table == "" {
    		return baseColumnName
    	}
    
    	s := strings.Split(table, "_")
    
    	var prefix string
    	switch len(s) {
    	case 1:
    		prefix = s[0][:3]
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  5. tests/preload_test.go

    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	var userIDs []uint
    	for _, user := range users {
    		userIDs = append(userIDs, user.ID)
    	}
    
    	var users2 []User
    	DB.Preload("Account", clause.Eq{Column: "number", Value: users[0].Account.Number}).Find(&users2, "id IN ?", userIDs)
    	sort.Slice(users2, func(i, j int) bool {
    		return users2[i].ID < users2[j].ID
    	})
    
    	for idx, user := range users2[1:2] {
    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)
  6. clause/expression_test.go

    			clause.Eq{Column: column, Value: (*string)(nil)},
    			clause.Eq{Column: column, Value: (*int)(nil)},
    			clause.Eq{Column: column, Value: (*bool)(nil)},
    			clause.Eq{Column: column, Value: (interface{})(nil)},
    			clause.Eq{Column: column, Value: sql.NullString{String: "", Valid: false}},
    		},
    		Result: "`column-name` IS NULL",
    	}, {
    		Expressions: []clause.Expression{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Aug 10 05:34:33 GMT 2023
    - 8.4K bytes
    - Viewed (0)
  7. association.go

    					}
    				} else {
    					tx.Clauses(clause.Eq{Column: ref.ForeignKey.DBName, Value: ref.PrimaryValue})
    				}
    			}
    
    			_, pvs := schema.GetIdentityFieldValuesMap(association.DB.Statement.Context, reflectValue, primaryFields)
    			if column, values := schema.ToQueryValues(rel.JoinTable.Table, joinPrimaryKeys, pvs); len(values) > 0 {
    				tx.Where(clause.IN{Column: column, Values: values})
    			} else {
    				return ErrPrimaryKeyRequired
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  8. tests/associations_test.go

    	}
    
    	if DB.First(&CouponProduct{}, "coupon_id = ? AND product_id = ?", coupon.ID, "full-save-association-product1").Error != nil {
    		t.Errorf("Failed to query saved association")
    	}
    
    	orders := []Order{{Num: "order1", Coupon: coupon}, {Num: "order2", Coupon: coupon}}
    	if err := DB.Create(&orders).Error; err != nil {
    		t.Errorf("failed to create orders, got %v", err)
    	}
    
    	coupon2 := Coupon{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  9. clause/group_by.go

    type GroupBy struct {
    	Columns []Column
    	Having  []Expression
    }
    
    // Name from clause name
    func (groupBy GroupBy) Name() string {
    	return "GROUP BY"
    }
    
    // Build build group by clause
    func (groupBy GroupBy) Build(builder Builder) {
    	for idx, column := range groupBy.Columns {
    		if idx > 0 {
    			builder.WriteByte(',')
    		}
    
    		builder.WriteQuoted(column)
    	}
    
    	if len(groupBy.Having) > 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 30 10:28:09 GMT 2021
    - 1K bytes
    - Viewed (0)
  10. schema/relationship.go

    			} else if ref.PrimaryValue != "" {
    				conds = append(conds, clause.Eq{
    					Column: clause.Column{Table: rel.JoinTable.Table, Name: ref.ForeignKey.DBName},
    					Value:  ref.PrimaryValue,
    				})
    			} else {
    				conds = append(conds, clause.Eq{
    					Column: clause.Column{Table: rel.JoinTable.Table, Name: ref.ForeignKey.DBName},
    					Value:  clause.Column{Table: rel.FieldSchema.Table, Name: ref.PrimaryKey.DBName},
    				})
    			}
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
Back to top