Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. schema/naming.go

    	IdentifierMaxLength int
    }
    
    // TableName convert string to table name
    func (ns NamingStrategy) TableName(str string) string {
    	if ns.SingularTable {
    		return ns.TablePrefix + ns.toDBName(str)
    	}
    	return ns.TablePrefix + inflection.Plural(ns.toDBName(str))
    }
    
    // SchemaName generate schema name from table name, don't guarantee it is the reverse value of TableName
    func (ns NamingStrategy) SchemaName(table string) string {
    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)
  2. migrator/index.go

    import "database/sql"
    
    // Index implements gorm.Index interface
    type Index struct {
    	TableName       string
    	NameValue       string
    	ColumnList      []string
    	PrimaryKeyValue sql.NullBool
    	UniqueValue     sql.NullBool
    	OptionValue     string
    }
    
    // Table return the table name of the index.
    func (idx Index) Table() string {
    	return idx.TableName
    }
    
    // Name return the name of the index.
    func (idx Index) Name() string {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 02:32:46 GMT 2023
    - 1023 bytes
    - Viewed (0)
  3. schema/schema_helper_test.go

    				}
    
    				if r.JoinTable.Table != relation.JoinTable.Table {
    					t.Errorf("schema %v relation's join table tablename expects %v, but got %v", s, relation.JoinTable.Table, r.JoinTable.Table)
    				}
    
    				for i := range relation.JoinTable.Fields {
    					checkSchemaField(t, r.JoinTable, &relation.JoinTable.Fields[i], nil)
    				}
    			}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  4. schema/naming_test.go

    	joinTable2 := ns.JoinTableName("UserLanguage")
    	if joinTable2 != "public.user_language" {
    		t.Errorf("invalid join table generated, got %v", joinTable2)
    	}
    
    	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)
    	}
    }
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue May 30 02:00:48 GMT 2023
    - 7K bytes
    - Viewed (0)
  5. tests/migrate_test.go

    	}
    
    	tableName := "null_string_model"
    
    	DB.Migrator().DropTable(tableName)
    
    	err := DB.Table(tableName).AutoMigrate(&NullModel{})
    	AssertEqual(t, err, nil)
    
    	// default null -> 'null'
    	err = DB.Table(tableName).AutoMigrate(&NullStringModel{})
    	AssertEqual(t, err, nil)
    
    	columnType, err := findColumnType(tableName, "content")
    	AssertEqual(t, err, nil)
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  6. tests/table_test.go

    	}
    
    	AssertEqual(t, r.Statement.Vars, []interface{}{2, 4, 1, 3})
    }
    
    type UserWithTableNamer struct {
    	gorm.Model
    	Name string
    }
    
    func (UserWithTableNamer) TableName(namer schema.Namer) string {
    	return namer.TableName("user")
    }
    
    func TestTableWithNamer(t *testing.T) {
    	db, _ := gorm.Open(tests.DummyDialector{}, &gorm.Config{
    		NamingStrategy: schema.NamingStrategy{
    			TablePrefix: "t_",
    		},
    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)
  7. schema/schema_test.go

    		checkSchemaField(t, user, &fields[i], func(f *schema.Field) {
    			f.Creatable = true
    			f.Updatable = true
    			f.Readable = true
    		})
    	}
    }
    
    type CustomizeTable struct{}
    
    func (CustomizeTable) TableName() string {
    	return "customize"
    }
    
    func TestCustomizeTableName(t *testing.T) {
    	customize, err := schema.Parse(&CustomizeTable{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  8. tests/serializer_test.go

    	CustomSerializerString string                 `gorm:"serializer:custom"`
    	EncryptedString        EncryptedString
    }
    
    func (*SerializerPostgresStruct) TableName() string { return "serializer_structs" }
    
    func adaptorSerializerModel(s *SerializerStruct) interface{} {
    	if DB.Dialector.Name() == "postgres" {
    		sps := SerializerPostgresStruct(*s)
    		return &sps
    	}
    	return s
    }
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  9. schema/schema.go

    		return s, s.err
    	}
    
    	modelValue := reflect.New(modelType)
    	tableName := namer.TableName(modelType.Name())
    	if tabler, ok := modelValue.Interface().(Tabler); ok {
    		tableName = tabler.TableName()
    	}
    	if tabler, ok := modelValue.Interface().(TablerWithNamer); ok {
    		tableName = tabler.TableName(namer)
    	}
    	if en, ok := namer.(embeddedNamer); ok {
    		tableName = en.Table
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. schema/relationship_test.go

    	})
    }
    
    type Author struct {
    	gorm.Model
    }
    
    type Book struct {
    	gorm.Model
    	Author   Author
    	AuthorID uint
    }
    
    func (Book) TableName() string {
    	return "my_schema.a_very_very_very_very_very_very_very_very_long_table_name"
    }
    
    func TestParseConstraintNameWithSchemaQualifiedLongTableName(t *testing.T) {
    	s, err := schema.Parse(
    		&Book{},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
Back to top