Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 64 for mapped (0.39 sec)

  1. tests/customize_field_test.go

    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCustomizeColumn(t *testing.T) {
    	type CustomizeColumn struct {
    		ID   int64      `gorm:"column:mapped_id; primary_key:yes"`
    		Name string     `gorm:"column:mapped_name"`
    		Date *time.Time `gorm:"column:mapped_time"`
    	}
    
    	DB.Migrator().DropTable(&CustomizeColumn{})
    	DB.AutoMigrate(&CustomizeColumn{})
    
    	expected := "foo"
    	now := time.Now()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  2. tests/create_test.go

    		ID uint
    	}
    	DB.Migrator().DropTable(&EmptyStruct{})
    
    	if err := DB.AutoMigrate(&EmptyStruct{}); err != nil {
    		t.Errorf("no error should happen when auto migrate, but got %v", err)
    	}
    
    	if err := DB.Create(&EmptyStruct{}).Error; err != nil {
    		t.Errorf("No error should happen when creating user, but got %v", err)
    	}
    }
    
    func TestCreateEmptySlice(t *testing.T) {
    	data := []User{}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  3. tests/associations_has_many_test.go

    	}
    
    	// Append
    	DB.Model(&users).Association("Pets").Append(
    		&Pet{Name: "pet-slice-append-1"},
    		[]*Pet{{Name: "pet-slice-append-2-1"}, {Name: "pet-slice-append-2-2"}},
    		&Pet{Name: "pet-slice-append-3"},
    	)
    
    	AssertAssociationCount(t, users, "Pets", 10, "After Append")
    
    	// Replace -> same as append
    	DB.Model(&users).Association("Pets").Replace(
    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)
  4. callbacks.go

    				if curIdx := getRIndex(sorted, c.name); curIdx == -1 {
    					// if before callback already sorted, append current callback just after it
    					sorted = append(sorted[:sortedIdx], append([]string{c.name}, sorted[sortedIdx:]...)...)
    				} else if curIdx > sortedIdx {
    					return fmt.Errorf("conflicting callback %s with before %s", c.name, c.before)
    				}
    			} else if idx := getRIndex(names, c.before); idx != -1 {
    				// if before callback exists
    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)
  5. tests/connpool_test.go

    }
    
    func (c *wrapperTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.PrepareContext(ctx, query)
    }
    
    func (c *wrapperTx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.ExecContext(ctx, query, args...)
    }
    
    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)
  6. scan.go

    							// nested relation fields
    							relFields := make([]*schema.Field, 0, subNameCount-1)
    							relFields = append(relFields, rel.Field)
    							for _, name := range names[1 : subNameCount-1] {
    								rel = rel.FieldSchema.Relationships.Relations[name]
    								relFields = append(relFields, rel.Field)
    							}
    							// lastest name is raw dbname
    							dbName := names[subNameCount-1]
    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)
  7. tests/embedded_struct_test.go

    		t.Errorf("no error should happen when query with embedded struct, but got %v", err)
    	} else if egNews.BasePost.Title != "engadget_news" {
    		t.Errorf("embedded struct's value should be scanned correctly")
    	}
    
    	var egPosts []EngadgetPost
    	if err := DB.Order("author_name asc").Find(&egPosts).Error; err != nil {
    		t.Fatalf("no error should happen when query with embedded struct, but got %v", err)
    	}
    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)
  8. tests/prepared_stmt_test.go

    	txCtx.Create(&user)
    
    	var result1 User
    	if err := txCtx.Find(&result1, user.ID).Error; err != nil {
    		t.Fatalf("no error should happen but got %v", err)
    	}
    
    	time.Sleep(time.Second)
    
    	var result2 User
    	if err := tx.Find(&result2, user.ID).Error; err != nil {
    		t.Fatalf("no error should happen but got %v", err)
    	}
    
    	user2 := *GetUser("prepared_stmt2", Config{})
    	if err := txCtx.Create(&user2).Error; err == nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  9. clause/returning.go

    		}
    	} else {
    		builder.WriteByte('*')
    	}
    }
    
    // MergeClause merge order by clauses
    func (returning Returning) MergeClause(clause *Clause) {
    	if v, ok := clause.Expression.(Returning); ok {
    		returning.Columns = append(v.Columns, returning.Columns...)
    	}
    
    	clause.Expression = returning
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Oct 27 23:56:55 GMT 2021
    - 681 bytes
    - Viewed (0)
  10. clause/order_by.go

    				orderBy.Columns = orderBy.Columns[i:]
    				clause.Expression = orderBy
    				return
    			}
    		}
    
    		copiedColumns := make([]OrderByColumn, len(v.Columns))
    		copy(copiedColumns, v.Columns)
    		orderBy.Columns = append(copiedColumns, orderBy.Columns...)
    	}
    
    	clause.Expression = orderBy
    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)
Back to top