Skip to content

Commit

Permalink
New Crowdin updates (#753)
Browse files Browse the repository at this point in the history
* New translations delete.md (Portuguese, Brazilian)

* New translations delete.md (Portuguese, Brazilian)

* New translations delete.md (Portuguese, Brazilian)

* New translations delete.md (Portuguese, Brazilian)

* New translations delete.md (Portuguese, Brazilian)

* New translations delete.md (Portuguese, Brazilian)

* New translations advanced_query.md (Hindi)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations models.md (Japanese)

* New translations community.md (French)

* New translations community.md (Spanish)

* New translations community.md (Arabic)

* New translations community.md (German)

* New translations community.md (Italian)

* New translations community.md (Japanese)

* New translations community.md (Korean)

* New translations community.md (Polish)

* New translations community.md (Russian)

* New translations community.md (Turkish)

* New translations community.md (Chinese Simplified)

* New translations community.md (Portuguese, Brazilian)

* New translations community.md (Indonesian)

* New translations community.md (Persian)

* New translations community.md (Azerbaijani)

* New translations community.md (Hindi)

* New translations sharding.md (French)

* New translations sharding.md (Spanish)

* New translations sharding.md (Arabic)

* New translations sharding.md (German)

* New translations sharding.md (Italian)

* New translations sharding.md (Japanese)

* New translations sharding.md (Korean)

* New translations sharding.md (Polish)

* New translations sharding.md (Russian)

* New translations sharding.md (Turkish)

* New translations sharding.md (Chinese Simplified)

* New translations sharding.md (Portuguese, Brazilian)

* New translations sharding.md (Indonesian)

* New translations sharding.md (Persian)

* New translations sharding.md (Azerbaijani)

* New translations sharding.md (Hindi)

* Update source file community.md

* Update source file sharding.md

* New translations connecting_to_the_database.md (Korean)

* New translations connecting_to_the_database.md (Korean)

* New translations advanced_query.md (Korean)

* New translations connecting_to_the_database.md (Korean)

* New translations composite_primary_key.md (Korean)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations connecting_to_the_database.md (Korean)

* New translations connecting_to_the_database.md (Korean)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations error_handling.md (Portuguese, Brazilian)

* New translations has_one.md (Portuguese, Brazilian)

* New translations has_one.md (Portuguese, Brazilian)

* New translations has_one.md (Portuguese, Brazilian)

* New translations advanced_query.md (Korean)

* New translations advanced_query.md (Korean)

* New translations connecting_to_the_database.md (Korean)

* New translations advanced_query.md (Portuguese, Brazilian)

* New translations create.md (Korean)

* New translations create.md (Korean)

* New translations 404.swig (Italian)

* New translations create.md (Korean)

* New translations create.md (Korean)

* New translations 404.swig (Russian)

* New translations community.md (Russian)

* New translations index.md (Russian)

* New translations index.md (Russian)

* New translations advanced_query.md (French)

* New translations has_many.md (French)

* New translations has_one.md (French)

* New translations en.yml (French)

* New translations polymorphism.md (French)

* New translations advanced_query.md (Spanish)

* New translations has_many.md (Spanish)

* New translations has_one.md (Spanish)

* New translations en.yml (Spanish)

* New translations polymorphism.md (Spanish)

* New translations advanced_query.md (Arabic)

* New translations has_many.md (Arabic)

* New translations has_one.md (Arabic)

* New translations en.yml (Arabic)

* New translations polymorphism.md (Arabic)

* New translations advanced_query.md (German)

* New translations has_many.md (German)

* New translations has_one.md (German)

* New translations en.yml (German)

* New translations polymorphism.md (German)

* New translations advanced_query.md (Italian)

* New translations has_many.md (Italian)

* New translations has_one.md (Italian)

* New translations en.yml (Italian)

* New translations polymorphism.md (Italian)

* New translations advanced_query.md (Japanese)

* New translations has_many.md (Japanese)

* New translations has_one.md (Japanese)

* New translations en.yml (Japanese)

* New translations polymorphism.md (Japanese)

* New translations advanced_query.md (Korean)

* New translations has_many.md (Korean)

* New translations has_one.md (Korean)

* New translations en.yml (Korean)

* New translations polymorphism.md (Korean)

* New translations advanced_query.md (Polish)

* New translations has_many.md (Polish)

* New translations has_one.md (Polish)

* New translations en.yml (Polish)

* New translations polymorphism.md (Polish)

* New translations advanced_query.md (Russian)

* New translations has_many.md (Russian)

* New translations has_one.md (Russian)

* New translations en.yml (Russian)

* New translations polymorphism.md (Russian)

* New translations advanced_query.md (Turkish)

* New translations has_many.md (Turkish)

* New translations has_one.md (Turkish)

* New translations en.yml (Turkish)

* New translations polymorphism.md (Turkish)

* New translations advanced_query.md (Chinese Simplified)

* New translations has_many.md (Chinese Simplified)

* New translations has_one.md (Chinese Simplified)

* New translations en.yml (Chinese Simplified)

* New translations polymorphism.md (Chinese Simplified)

* New translations advanced_query.md (Portuguese, Brazilian)

* New translations has_many.md (Portuguese, Brazilian)

* New translations has_one.md (Portuguese, Brazilian)

* New translations en.yml (Portuguese, Brazilian)

* New translations polymorphism.md (Portuguese, Brazilian)

* New translations advanced_query.md (Indonesian)

* New translations has_many.md (Indonesian)

* New translations has_one.md (Indonesian)

* New translations en.yml (Indonesian)

* New translations polymorphism.md (Indonesian)

* New translations advanced_query.md (Persian)

* New translations has_many.md (Persian)

* New translations has_one.md (Persian)

* New translations en.yml (Persian)

* New translations polymorphism.md (Persian)

* New translations advanced_query.md (Azerbaijani)

* New translations has_many.md (Azerbaijani)

* New translations has_one.md (Azerbaijani)

* New translations en.yml (Azerbaijani)

* New translations polymorphism.md (Azerbaijani)

* New translations advanced_query.md (Hindi)

* New translations has_many.md (Hindi)

* New translations has_one.md (Hindi)

* New translations en.yml (Hindi)

* New translations polymorphism.md (Hindi)
  • Loading branch information
jinzhu authored Jun 12, 2024
1 parent ac21474 commit bd4c008
Show file tree
Hide file tree
Showing 122 changed files with 1,112 additions and 1,657 deletions.
1 change: 1 addition & 0 deletions pages/ar_SA/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ layout: page
* [deepgorm - Nested map filtering](https://github.com/survivorbat/gorm-deep-filtering)
* [oracle - GORM Oracle driver](https://github.com/CengSin/oracle)
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)

## <span id="contribute">Contribute to this page</span>

Expand Down
2 changes: 1 addition & 1 deletion pages/ar_SA/docs/advanced_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func PaidWithCreditCard(db *gorm.DB) *gorm.DB {

// Scope for orders paid with cash on delivery (COD)
func PaidWithCod(db *gorm.DB) *gorm.DB {
return db.Where("pay_mode_sign = ?", "C")
return db.Where("pay_mode_sign = ?", "COD")
}

// Scope for filtering orders by status
Expand Down
43 changes: 0 additions & 43 deletions pages/ar_SA/docs/has_many.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,49 +76,6 @@ type CreditCard struct {
}
```

## Polymorphism Association

GORM supports polymorphism association for `has one` and `has many`, it will save owned entity's table name into polymorphic type's field, primary key value into the polymorphic field

```go
type Dog struct {
ID int
Name string
Toys []Toy `gorm:"polymorphic:Owner;"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","dogs"), ("toy2","1","dogs")
```

You can change the polymorphic type value with tag `polymorphicValue`, for example:

```go
type Dog struct {
ID int
Name string
Toys []Toy `gorm:"polymorphic:Owner;polymorphicValue:master"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","master"), ("toy2","1","master")
```

## CRUD with Has Many

Expand Down
50 changes: 0 additions & 50 deletions pages/ar_SA/docs/has_one.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,56 +78,6 @@ type CreditCard struct {
}
```

## Polymorphism Association

GORM supports polymorphism association for `has one` and `has many`, it will save owned entity's table name into polymorphic type's field, primary key into the polymorphic field

```go
type Cat struct {
ID int
Name string
Toy Toy `gorm:"polymorphic:Owner;"`
}

type Dog struct {
ID int
Name string
Toy Toy `gorm:"polymorphic:Owner;"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toy: Toy{Name: "toy1"}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","dogs")
```

You can change the polymorphic type value with tag `polymorphicValue`, for example:

```go
type Dog struct {
ID int
Name string
Toy Toy `gorm:"polymorphic:Owner;polymorphicValue:master"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toy: Toy{Name: "toy1"}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","master")
```

## CRUD with Has One

Please checkout [Association Mode](associations.html#Association-Mode) for working with `has one` relations
Expand Down
57 changes: 57 additions & 0 deletions pages/ar_SA/docs/polymorphism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Polymorphism
layout: Page
---

## Polymorphism Association

GORM supports polymorphism association for `has one` and `has many`, it will save owned entity's table name into polymorphic type's field, primary key value into the polymorphic field

By default `polymorphic:<value>` will prefix the column type and column id with `<value>`.
The value will be the table name pluralized.

```go
type Dog struct {
ID int
Name string
Toys []Toy `gorm:"polymorphic:Owner;"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1",1,"dogs"), ("toy2",1,"dogs")
```

You can specify polymorphism properties separately using the following GORM tags:

- `polymorphicType`: Specifies the column type.
- `polymorphicId`: Specifies the column ID.
- `polymorphicValue`: Specifies the value of the type.

```go
type Dog struct {
ID int
Name string
Toys Toy `gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:master"`
}

type Toy struct {
ID int
Name string
OwnerID int
Kind string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`kind`) VALUES ("toy1",1,"master"), ("toy2",1,"master")
```

In these examples, we've used a has-many relationship, but the same principles apply to has-one relationships.
2 changes: 1 addition & 1 deletion pages/ar_SA/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ https://github.com/go-gorm/sharding

## Usage

Config the sharding middleware, register the tables which you want to shard. See [Godoc](https://pkg.go.dev/github.com/go-gorm/sharding) for config details.
Config the sharding middleware, register the tables which you want to shard. See [Godoc](https://pkg.go.dev/gorm.io/sharding) for config details.

```go
import (
Expand Down
1 change: 1 addition & 0 deletions pages/az_AZ/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ layout: page
* [deepgorm - Nested map filtering](https://github.com/survivorbat/gorm-deep-filtering)
* [oracle - GORM Oracle driver](https://github.com/CengSin/oracle)
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)

## <span id="contribute">Contribute to this page</span>

Expand Down
2 changes: 1 addition & 1 deletion pages/az_AZ/docs/advanced_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func PaidWithCreditCard(db *gorm.DB) *gorm.DB {

// Scope for orders paid with cash on delivery (COD)
func PaidWithCod(db *gorm.DB) *gorm.DB {
return db.Where("pay_mode_sign = ?", "C")
return db.Where("pay_mode_sign = ?", "COD")
}

// Scope for filtering orders by status
Expand Down
43 changes: 0 additions & 43 deletions pages/az_AZ/docs/has_many.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,49 +77,6 @@ type CreditCard struct {
}
```

## Polymorphism Association

GORM supports polymorphism association for `has one` and `has many`, it will save owned entity's table name into polymorphic type's field, primary key value into the polymorphic field

```go
type Dog struct {
ID int
Name string
Toys []Toy `gorm:"polymorphic:Owner;"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","dogs"), ("toy2","1","dogs")
```

You can change the polymorphic type value with tag `polymorphicValue`, for example:

```go
type Dog struct {
ID int
Name string
Toys []Toy `gorm:"polymorphic:Owner;polymorphicValue:master"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","master"), ("toy2","1","master")
```

## CRUD with Has Many

Expand Down
50 changes: 0 additions & 50 deletions pages/az_AZ/docs/has_one.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,56 +78,6 @@ type CreditCard struct {
}
```

## Polymorphism Association

GORM supports polymorphism association for `has one` and `has many`, it will save owned entity's table name into polymorphic type's field, primary key into the polymorphic field

```go
type Cat struct {
ID int
Name string
Toy Toy `gorm:"polymorphic:Owner;"`
}

type Dog struct {
ID int
Name string
Toy Toy `gorm:"polymorphic:Owner;"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toy: Toy{Name: "toy1"}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","dogs")
```

You can change the polymorphic type value with tag `polymorphicValue`, for example:

```go
type Dog struct {
ID int
Name string
Toy Toy `gorm:"polymorphic:Owner;polymorphicValue:master"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toy: Toy{Name: "toy1"}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1","1","master")
```

## CRUD with Has One

Please checkout [Association Mode](associations.html#Association-Mode) for working with `has one` relations
Expand Down
57 changes: 57 additions & 0 deletions pages/az_AZ/docs/polymorphism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Polymorphism
layout: Page
---

## Polymorphism Association

GORM supports polymorphism association for `has one` and `has many`, it will save owned entity's table name into polymorphic type's field, primary key value into the polymorphic field

By default `polymorphic:<value>` will prefix the column type and column id with `<value>`.
The value will be the table name pluralized.

```go
type Dog struct {
ID int
Name string
Toys []Toy `gorm:"polymorphic:Owner;"`
}

type Toy struct {
ID int
Name string
OwnerID int
OwnerType string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`owner_type`) VALUES ("toy1",1,"dogs"), ("toy2",1,"dogs")
```

You can specify polymorphism properties separately using the following GORM tags:

- `polymorphicType`: Specifies the column type.
- `polymorphicId`: Specifies the column ID.
- `polymorphicValue`: Specifies the value of the type.

```go
type Dog struct {
ID int
Name string
Toys Toy `gorm:"polymorphicType:Kind;polymorphicId:OwnerID;polymorphicValue:master"`
}

type Toy struct {
ID int
Name string
OwnerID int
Kind string
}

db.Create(&Dog{Name: "dog1", Toys: []Toy{{Name: "toy1"}, {Name: "toy2"}}})
// INSERT INTO `dogs` (`name`) VALUES ("dog1")
// INSERT INTO `toys` (`name`,`owner_id`,`kind`) VALUES ("toy1",1,"master"), ("toy2",1,"master")
```

In these examples, we've used a has-many relationship, but the same principles apply to has-one relationships.
2 changes: 1 addition & 1 deletion pages/az_AZ/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ https://github.com/go-gorm/sharding

## Usage

Config the sharding middleware, register the tables which you want to shard. See [Godoc](https://pkg.go.dev/github.com/go-gorm/sharding) for config details.
Config the sharding middleware, register the tables which you want to shard. See [Godoc](https://pkg.go.dev/gorm.io/sharding) for config details.

```go
import (
Expand Down
1 change: 1 addition & 0 deletions pages/de_DE/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ layout: page
* [deepgorm - Nested map filtering](https://github.com/survivorbat/gorm-deep-filtering)
* [oracle - GORM Oracle driver](https://github.com/CengSin/oracle)
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)

## <span id="contribute">Trage zu dieser Seite bei</span>

Expand Down
2 changes: 1 addition & 1 deletion pages/de_DE/docs/advanced_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func PaidWithCreditCard(db *gorm.DB) *gorm.DB {

// Scope for orders paid with cash on delivery (COD)
func PaidWithCod(db *gorm.DB) *gorm.DB {
return db.Where("pay_mode_sign = ?", "C")
return db.Where("pay_mode_sign = ?", "COD")
}

// Scope for filtering orders by status
Expand Down
Loading

0 comments on commit bd4c008

Please sign in to comment.