Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for ColumnName (0.2 sec)

  1. schema/naming.go

    	table = strings.TrimPrefix(table, ns.TablePrefix)
    
    	if ns.SingularTable {
    		return ns.toSchemaName(table)
    	}
    	return ns.toSchemaName(inflection.Singular(table))
    }
    
    // ColumnName convert string to column name
    func (ns NamingStrategy) ColumnName(table, column string) string {
    	return ns.toDBName(column)
    }
    
    // JoinTableName convert string to join table name
    func (ns NamingStrategy) JoinTableName(str string) string {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  2. callbacks/associations.go

    		values         = rValues.Interface()
    	)
    
    	for name, ok := range selectColumns {
    		columnName := ""
    		if strings.HasPrefix(name, refName) {
    			columnName = strings.TrimPrefix(name, refName)
    		}
    
    		if columnName != "" {
    			if ok {
    				selects = append(selects, columnName)
    			} else {
    				omits = append(omits, columnName)
    			}
    		}
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  3. schema/naming_test.go

    	}
    
    	tableName := ns.TableName("Company")
    	if tableName != "public.company" {
    		t.Errorf("invalid table name generated, got %v", tableName)
    	}
    
    	columdName := ns.ColumnName("", "NameCID")
    	if columdName != "name_cid" {
    		t.Errorf("invalid column name generated, got %v", columdName)
    	}
    }
    
    type CustomReplacer struct {
    	f func(string) string
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue May 30 02:00:48 GMT 2023
    - 7K bytes
    - Viewed (0)
  4. tests/migrate_test.go

    	AssertEqual(t, false, ok)
    }
    
    func findColumnType(dest interface{}, columnName string) (
    	foundColumn gorm.ColumnType, err error,
    ) {
    	columnTypes, err := DB.Migrator().ColumnTypes(dest)
    	if err != nil {
    		err = fmt.Errorf("ColumnTypes err:%v", err)
    		return
    	}
    
    	for _, c := range columnTypes {
    		if c.Name() == columnName {
    			foundColumn = c
    			break
    		}
    	}
    	return
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  5. schema/schema_test.go

    				f.Readable = true
    			}
    		})
    	}
    }
    
    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:
    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)
  6. statement.go

    		if matches := nameMatcher.FindStringSubmatch(tableColumn); len(matches) == 4 {
    			table = matches[1]
    			star := matches[2]
    			columnName := matches[3]
    			if star != "" {
    				return table, star
    			}
    			return table, columnName
    		}
    		return "", ""
    	}
    }()
    
    // SelectAndOmitColumns get select and omit columns, select -> true, omit -> false
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  7. association.go

    	for name, ok := range selectColumns {
    		columnName := ""
    		if strings.HasPrefix(name, association.Relationship.Name) {
    			if columnName = strings.TrimPrefix(name, association.Relationship.Name); columnName == ".*" {
    				columnName = name
    			}
    		} else if strings.HasPrefix(name, clause.Associations) {
    			columnName = name
    		}
    
    		if columnName != "" {
    			if ok {
    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/query_test.go

    			t.Errorf("errors happened when query first: %v", err)
    		} else {
    			for _, name := range []string{"Name", "Age", "Birthday"} {
    				t.Run(name, func(t *testing.T) {
    					dbName := DB.NamingStrategy.ColumnName("", name)
    
    					switch name {
    					case "Name":
    						if _, ok := first[dbName].(string); !ok {
    							t.Errorf("invalid data type for %v, got %#v", dbName, first[dbName])
    						}
    					case "Age":
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
  9. schema/schema.go

    			} else {
    				schema.Fields = append(schema.Fields, field)
    			}
    		}
    	}
    
    	for _, field := range schema.Fields {
    		if field.DBName == "" && field.DataType != "" {
    			field.DBName = namer.ColumnName(schema.Table, field.Name)
    		}
    
    		bindName := field.BindName()
    		if field.DBName != "" {
    			// nonexistence or shortest path or first appear prioritized if has permission
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. schema/relationship.go

    			if len(primaryFields) == 1 {
    				lookUpNames = append(lookUpNames, strings.TrimSuffix(lookUpName, primaryField.Name)+"ID",
    					strings.TrimSuffix(lookUpName, primaryField.Name)+"Id", schema.namer.ColumnName(foreignSchema.Table,
    						strings.TrimSuffix(lookUpName, primaryField.Name)+"ID"))
    			}
    
    			for _, name := range lookUpNames {
    				if f := foreignSchema.LookUpFieldByBindName(field.BindNames, name); f != nil {
    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