Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 54 for primary_key (0.06 sec)

  1. docs/de/docs/tutorial/sql-databases.md

    * `table=True` sagt SQLModel, dass dies ein *Tabellenmodell* ist, es soll eine **Tabelle** in der SQL-Datenbank darstellen, es ist nicht nur ein *Datenmodell* (wie es jede andere reguläre Pydantic-Klasse wäre).
    
    * `Field(primary_key=True)` sagt SQLModel, dass die `id` der **Primärschlüssel** in der SQL-Datenbank ist (Sie können mehr über SQL-Primärschlüssel in der SQLModel-Dokumentation erfahren).
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 02 17:32:56 UTC 2025
    - 18.1K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/sql-databases.md

    `Hero` 类与 Pydantic 模型非常相似(实际上,从底层来看,它确实*就是一个 Pydantic 模型*)。
    
    有一些区别:
    
    * `table=True` 会告诉 SQLModel 这是一个*表模型*,它应该表示 SQL 数据库中的一个*表*,而不仅仅是一个*数据模型*(就像其他常规的 Pydantic 类一样)。
    
    * `Field(primary_key=True)` 会告诉 SQLModel `id` 是 SQL 数据库中的**主键**(您可以在 SQLModel 文档中了解更多关于 SQL 主键的信息)。
    
        把类型设置为 `int | None` ,SQLModel 就能知道该列在 SQL 数据库中应该是 `INTEGER` 类型,并且应该是 `NULLABLE` 。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Dec 15 17:11:14 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  3. docs/ko/docs/tutorial/sql-databases.md

    몇 가지 차이점이 있습니다:
    
    * `table=True`는 SQLModel에 이 모델이 *테이블 모델*이며, 단순한 데이터 모델이 아니라 SQL 데이터베이스의 **테이블**을 나타낸다는 것을 알려줍니다. (다른 일반적인 Pydantic 클래스처럼) 단순한 *데이터 모델*이 아닙니다.
    
    * `Field(primary_key=True)`는 SQLModel에 `id`가 SQL 데이터베이스의 **기본 키**임을 알려줍니다 (SQL 기본 키에 대한 자세한 내용은 SQLModel 문서를 참고하세요).
    
        `int | None` 유형으로 설정하면, SQLModel은 해당 열이 SQL 데이터베이스에서 `INTEGER` 유형이며 `NULLABLE` 값이어야 한다는 것을 알 수 있습니다.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 24 16:14:29 UTC 2024
    - 18K bytes
    - Viewed (0)
  4. tests/update_test.go

    	Name  string
    	Token Token `gorm:"foreignKey:UserID"`
    }
    
    func (t *TokenOwner) BeforeSave(tx *gorm.DB) error {
    	t.Name += "_name"
    	return nil
    }
    
    type Token struct {
    	UserID  int    `gorm:"primary_key"`
    	Content string `gorm:"type:varchar(100)"`
    }
    
    func (t *Token) BeforeSave(tx *gorm.DB) error {
    	t.Content += "_encrypted"
    	return nil
    }
    
    func TestSaveWithHooks(t *testing.T) {
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Jul 21 02:46:58 UTC 2025
    - 30.4K bytes
    - Viewed (0)
  5. tests/query_test.go

    	}
    
    	AssertEqual(t, p, p2)
    }
    
    func TestStringPrimaryKeyForNumericValueStartingWithZero(t *testing.T) {
    	type AddressByZipCode struct {
    		ZipCode string `gorm:"primary_key"`
    		Address string
    	}
    
    	DB.Migrator().DropTable(&AddressByZipCode{})
    	if err := DB.AutoMigrate(&AddressByZipCode{}); err != nil {
    		t.Fatalf("failed to migrate, got error %v", err)
    	}
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Tue Jul 22 06:21:04 UTC 2025
    - 51K bytes
    - Viewed (0)
  6. schema/relationship.go

    	} else {
    		primarySchemaName := primarySchema.Name
    		if primarySchemaName == "" {
    			primarySchemaName = relation.FieldSchema.Name
    		}
    
    		if len(relation.primaryKeys) > 0 {
    			for _, primaryKey := range relation.primaryKeys {
    				if f := primarySchema.LookUpField(primaryKey); f != nil {
    					primaryFields = append(primaryFields, f)
    				}
    			}
    		} else {
    			primaryFields = primarySchema.PrimaryFields
    		}
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun Nov 16 04:11:05 UTC 2025
    - 23.1K bytes
    - Viewed (1)
  7. migrator/migrator.go

    				createTableSQL += "PRIMARY KEY ?,"
    				primaryKeys := make([]interface{}, 0, len(stmt.Schema.PrimaryFields))
    				for _, field := range stmt.Schema.PrimaryFields {
    					primaryKeys = append(primaryKeys, clause.Column{Name: field.DBName})
    				}
    
    				values = append(values, primaryKeys)
    			}
    
    			for _, idx := range stmt.Schema.ParseIndexes() {
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun Oct 26 12:31:09 UTC 2025
    - 29.7K bytes
    - Viewed (0)
  8. schema/schema_helper_test.go

    					for _, rf := range r.References {
    						var primaryKey, primaryKeySchema string
    						if rf.PrimaryKey != nil {
    							primaryKey, primaryKeySchema = rf.PrimaryKey.Name, rf.PrimaryKey.Schema.Name
    						}
    						refs = append(refs, fmt.Sprintf(
    							"{PrimaryKey: %v PrimaryKeySchame: %v ForeignKey: %v ForeignKeySchema: %v PrimaryValue: %v OwnPrimaryKey: %v}",
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Thu Aug 28 02:57:17 UTC 2025
    - 7.5K bytes
    - Viewed (0)
  9. schema/schema_test.go

    	// check fields
    	fields := []schema.Field{
    		{Name: "ID", DBName: "id", BindNames: []string{"Model", "ID"}, DataType: schema.Uint, PrimaryKey: true, Tag: `gorm:"primarykey"`, TagSettings: map[string]string{"PRIMARYKEY": "PRIMARYKEY"}, Size: 64, HasDefaultValue: true, AutoIncrement: true},
    		{Name: "CreatedAt", DBName: "created_at", BindNames: []string{"Model", "CreatedAt"}, DataType: schema.Time},
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Thu Aug 28 02:57:17 UTC 2025
    - 13.3K bytes
    - Viewed (0)
  10. utils/tests/models.go

    	Name     string
    	CustomID string
    	Type     string
    }
    
    type Company struct {
    	ID   int
    	Name string
    }
    
    type Language struct {
    	Code string `gorm:"primarykey"`
    	Name string
    }
    
    type Coupon struct {
    	ID               int              `gorm:"primarykey; size:255"`
    	AppliesToProduct []*CouponProduct `gorm:"foreignKey:CouponId;constraint:OnDelete:CASCADE"`
    	AmountOff        uint32           `gorm:"column:amount_off"`
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Dec 15 08:36:08 UTC 2023
    - 2.1K bytes
    - Viewed (0)
Back to top