Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 68 for couldn (0.14 sec)

  1. clause/order_by.go

    			if idx > 0 {
    				builder.WriteByte(',')
    			}
    
    			builder.WriteQuoted(column.Column)
    			if column.Desc {
    				builder.WriteString(" DESC")
    			}
    		}
    	}
    }
    
    // MergeClause merge order by clauses
    func (orderBy OrderBy) MergeClause(clause *Clause) {
    	if v, ok := clause.Expression.(OrderBy); ok {
    		for i := len(orderBy.Columns) - 1; i >= 0; i-- {
    			if orderBy.Columns[i].Reorder {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 03 02:30:05 GMT 2020
    - 1.1K bytes
    - Viewed (0)
  2. scan.go

    	for idx, column := range columns {
    		if reflectValue := reflect.Indirect(reflect.Indirect(reflect.ValueOf(values[idx]))); reflectValue.IsValid() {
    			mapValue[column] = reflectValue.Interface()
    			if valuer, ok := mapValue[column].(driver.Valuer); ok {
    				mapValue[column], _ = valuer.Value()
    			} else if b, ok := mapValue[column].(sql.RawBytes); ok {
    				mapValue[column] = string(b)
    			}
    		} else {
    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/helper_test.go

    				"name": "my name",
    			},
    			expect: clause.Values{
    				Columns: []clause.Column{{Name: "name"}},
    				Values:  [][]interface{}{{"my name"}},
    			},
    		},
    		{
    			name: "Test convert int value",
    			input: map[string]interface{}{
    				"age": 18,
    			},
    			expect: clause.Values{
    				Columns: []clause.Column{{Name: "age"}},
    				Values:  [][]interface{}{{18}},
    			},
    		},
    		{
    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)
  4. clause/set_test.go

    	assignments := []clause.Assignment(set)
    
    	sort.Slice(assignments, func(i, j int) bool {
    		return strings.Compare(assignments[i].Column.Name, assignments[j].Column.Name) > 0
    	})
    
    	if len(assignments) != 2 || assignments[0].Column.Name != "name" || assignments[0].Value.(string) != "jinzhu" || assignments[1].Column.Name != "age" || assignments[1].Value.(int) != 18 {
    		t.Errorf("invalid assignments, got %v", assignments)
    	}
    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)
  5. clause/returning.go

    type Returning struct {
    	Columns []Column
    }
    
    // Name where clause name
    func (returning Returning) Name() string {
    	return "RETURNING"
    }
    
    // Build build where clause
    func (returning Returning) Build(builder Builder) {
    	if len(returning.Columns) > 0 {
    		for idx, column := range returning.Columns {
    			if idx > 0 {
    				builder.WriteByte(',')
    			}
    
    			builder.WriteQuoted(column)
    		}
    	} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Oct 27 23:56:55 GMT 2021
    - 681 bytes
    - Viewed (0)
  6. schema/constraint.go

    }
    
    func (uni *UniqueConstraint) GetName() string { return uni.Name }
    
    func (uni *UniqueConstraint) Build() (sql string, vars []interface{}) {
    	return "CONSTRAINT ? UNIQUE (?)", []interface{}{clause.Column{Name: uni.Name}, clause.Column{Name: uni.Field.DBName}}
    }
    
    // ParseUniqueConstraints parse schema unique constraints
    func (schema *Schema) ParseUniqueConstraints() map[string]UniqueConstraint {
    	uniques := make(map[string]UniqueConstraint)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  7. clause/values_test.go

    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{
    				clause.Insert{},
    				clause.Values{
    					Columns: []clause.Column{{Name: "name"}, {Name: "age"}},
    					Values:  [][]interface{}{{"jinzhu", 18}, {"josh", 1}},
    				},
    			},
    			"INSERT INTO `users` (`name`,`age`) VALUES (?,?),(?,?)",
    			[]interface{}{"jinzhu", 18, "josh", 1},
    		},
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 691 bytes
    - Viewed (0)
  8. tests/embedded_struct_test.go

    		t.Fatalf("failed to auto migrate, got error: %v", err)
    	}
    
    	for _, name := range []string{"author_id", "author_name", "author_email"} {
    		if !DB.Migrator().HasColumn(&EngadgetPost{}, name) {
    			t.Errorf("should has prefixed column %v", name)
    		}
    	}
    
    	stmt := gorm.Statement{DB: DB}
    	if err := stmt.Parse(&EngadgetPost{}); err != nil {
    		t.Fatalf("failed to parse embedded struct")
    	} else if len(stmt.Schema.PrimaryFields) != 1 {
    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)
  9. tests/connpool_test.go

    //
    //	func (c *wrapperConnPool) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {
    //		 return c.db.BeginTx(ctx, opts)
    //	}
    //
    // You should use BeginTx returned gorm.Tx which could wrap *sql.Tx then you can record all queries.
    func (c *wrapperConnPool) BeginTx(ctx context.Context, opts *sql.TxOptions) (gorm.ConnPool, error) {
    	tx, err := c.db.BeginTx(ctx, opts)
    	if err != nil {
    		return nil, err
    	}
    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)
  10. schema/relationship_test.go

    	})
    }
    
    func TestHasOneOverrideReferences2(t *testing.T) {
    	type Profile struct {
    		gorm.Model
    		Name string
    	}
    
    	type User struct {
    		gorm.Model
    		ProfileID uint     `gorm:"column:profile_id"`
    		Profile   *Profile `gorm:"foreignKey:ID;references:ProfileID"`
    	}
    
    	checkStructRelation(t, &User{}, Relation{
    		Name: "Profile", Type: schema.HasOne, Schema: "User", FieldSchema: "Profile",
    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)
Back to top