Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 72 for table (0.14 sec)

  1. tests/table_test.go

    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("`people`").Table("`user`").Find(&User{}).Statement
    	if !regexp.MustCompile("SELECT \\* FROM `user`").MatchString(r.Statement.SQL.String()) {
    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("people as p").Table("user as u").Find(&User{}).Statement
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  2. migrator/table_type.go

    package migrator
    
    import (
    	"database/sql"
    )
    
    // TableType table type implements TableType interface
    type TableType struct {
    	SchemaValue  string
    	NameValue    string
    	TypeValue    string
    	CommentValue sql.NullString
    }
    
    // Schema returns the schema of the table.
    func (ct TableType) Schema() string {
    	return ct.SchemaValue
    }
    
    // Name returns the name of the table.
    func (ct TableType) Name() string {
    	return ct.NameValue
    }
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri May 05 07:58:27 GMT 2023
    - 688 bytes
    - Viewed (0)
  3. tests/joins_table_test.go

    func TestOverrideJoinTable(t *testing.T) {
    	DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{})
    
    	if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil {
    		t.Fatalf("Failed to setup join table for person, got error %v", err)
    	}
    
    	if err := DB.AutoMigrate(&Person{}, &Address{}); err != nil {
    		t.Fatalf("Failed to migrate, got %v", err)
    	}
    
    	address1 := Address{Name: "address 1"}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Sep 10 13:46:18 GMT 2020
    - 3.5K bytes
    - Viewed (0)
  4. clause/from_test.go

    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{
    					Tables: []clause.Table{{Name: "users"}},
    					Joins: []clause.Join{
    						{
    							Type:  clause.RightJoin,
    							Table: clause.Table{Name: "profiles"},
    							ON: clause.Where{
    								[]clause.Expression{clause.Eq{clause.Column{Table: "profiles", Name: "email"}, clause.Column{Table: clause.CurrentTable, Name: "email"}}},
    							},
    						},
    					},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  5. tests/scan_test.go

    		ID   uint
    		Name string
    		Age  int
    	}
    
    	var res result
    	DB.Table("users").Select("id, name, age").Where("id = ?", user3.ID).Scan(&res)
    	if res.ID != user3.ID || res.Name != user3.Name || res.Age != int(user3.Age) {
    		t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user3)
    	}
    
    	var resPointer *result
    	if err := DB.Table("users").Select("id, name, age").Where("id = ?", user3.ID).Scan(&resPointer).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  6. schema/utils.go

    }
    
    // ToQueryValues to query values
    func ToQueryValues(table string, foreignKeys []string, foreignValues [][]interface{}) (interface{}, []interface{}) {
    	queryValues := make([]interface{}, len(foreignValues))
    	if len(foreignKeys) == 1 {
    		for idx, r := range foreignValues {
    			queryValues[idx] = r[0]
    		}
    
    		return clause.Column{Table: table, Name: foreignKeys[0]}, queryValues
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  7. tests/update_test.go

    	DB.First(&result2, "code = ?", "save")
    	AssertEqual(t, result2, lang)
    
    	DB.Table("langs").Migrator().DropTable(&Language{})
    	DB.Table("langs").AutoMigrate(&Language{})
    
    	if err := DB.Table("langs").Save(&lang).Error; err != nil {
    		t.Errorf("no error should happen when creating data, but got %v", err)
    	}
    
    	var result3 Language
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  8. schema/index.go

    								field.Schema.Name,
    								field.Name)
    							return
    						}
    						subName = composite
    					}
    					name = field.Schema.namer.IndexName(
    						field.Schema.Table, subName)
    				}
    
    				if (k == "UNIQUEINDEX") || settings["UNIQUE"] != "" {
    					settings["CLASS"] = "UNIQUE"
    				}
    
    				priority, err := strconv.Atoi(settings["PRIORITY"])
    				if err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  9. schema/naming.go

    )
    
    // Namer namer interface
    type Namer interface {
    	TableName(table string) string
    	SchemaName(table string) string
    	ColumnName(table, column string) string
    	JoinTableName(joinTable string) string
    	RelationshipFKName(Relationship) string
    	CheckerName(table, column string) string
    	IndexName(table, column string) string
    	UniqueName(table, column string) string
    }
    
    // Replacer replacer interface like strings.Replacer
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  10. migrator/migrator.go

    		currentDatabase := m.DB.Migrator().CurrentDatabase()
    		return m.DB.Raw("SELECT count(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ? AND table_type = ?", currentDatabase, stmt.Table, "BASE TABLE").Row().Scan(&count)
    	})
    
    	return count > 0
    }
    
    // RenameTable rename table from oldName to newName
    func (m Migrator) RenameTable(oldName, newName interface{}) error {
    	var oldTable, newTable interface{}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
Back to top