Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for ParseUniqueConstraints (0.34 sec)

  1. schema/constraint.go

    	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)
    	for _, field := range schema.Fields {
    		if field.Unique {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  2. schema/constraint_test.go

    	}
    
    	user, err := schema.Parse(&UserUnique{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse user unique, got error %v", err)
    	}
    	constraints := user.ParseUniqueConstraints()
    
    	results := map[string]schema.UniqueConstraint{
    		"uni_user_uniques_name1": {
    			Name:  "uni_user_uniques_name1",
    			Field: &schema.Field{Name: "Name1", Unique: true},
    		},
    	}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  3. tests/table_test.go

    		user, err := schema.Parse(&LongString{}, &sync.Map{}, db.Config.NamingStrategy)
    		if err != nil {
    			t.Fatalf("failed to parse user unique, got error %v", err)
    		}
    
    		constraints := user.ParseUniqueConstraints()
    		if len(constraints) != 1 {
    			t.Fatalf("failed to find unique constraint, got %v", constraints)
    		}
    
    		for key := range constraints {
    			if len(key) != 63 {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  4. migrator/migrator.go

    							sql, vars := constraint.Build()
    							createTableSQL += sql + ","
    							values = append(values, vars...)
    						}
    					}
    				}
    			}
    
    			for _, uni := range stmt.Schema.ParseUniqueConstraints() {
    				createTableSQL += "CONSTRAINT ? UNIQUE (?),"
    				values = append(values, clause.Column{Name: uni.Name}, clause.Expr{SQL: stmt.Quote(uni.Field.DBName)})
    			}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 28.5K bytes
    - Viewed (0)
Back to top