Skip to content

Commit

Permalink
New Crowdin updates (#744)
Browse files Browse the repository at this point in the history
* Update source file database_to_structs.md

* New translations database_to_structs.md (French)

* New translations database_to_structs.md (Spanish)

* New translations database_to_structs.md (Arabic)

* New translations database_to_structs.md (German)

* New translations database_to_structs.md (Italian)

* New translations database_to_structs.md (Japanese)

* New translations database_to_structs.md (Korean)

* New translations database_to_structs.md (Polish)

* New translations database_to_structs.md (Russian)

* New translations database_to_structs.md (Turkish)

* New translations database_to_structs.md (Chinese Simplified)

* New translations database_to_structs.md (Portuguese, Brazilian)

* New translations database_to_structs.md (Indonesian)

* New translations database_to_structs.md (Persian)

* New translations database_to_structs.md (Azerbaijani)

* New translations database_to_structs.md (Hindi)

* Update source file database_to_structs.md

* New translations context.md (Chinese Simplified)

* New translations associations.md (Russian)
  • Loading branch information
jinzhu authored Mar 15, 2024
1 parent 2146bed commit fed7b64
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 20 deletions.
4 changes: 4 additions & 0 deletions pages/ar_SA/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/az_AZ/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/de_DE/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/es_ES/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/fa_IR/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/fr_FR/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/hi_IN/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/id_ID/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/it_IT/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/ja_JP/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/ko_KR/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/pl_PL/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/pt_BR/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
8 changes: 4 additions & 4 deletions pages/ru_RU/gen/associations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ title: Associations
layout: page
---

GEN will auto-save associations as GORM do. The relationships (BelongsTo/HasOne/HasMany/Many2Many) reuse GORM's tag. This feature only support exist model for now.
GEN will auto-save associations as GORM do. Отношения (один к одному, один ко многим, многие к одному, многие ко многим) повторно используют тег GORM. На данный момент эта функциональность поддерживает только существующие модели.

## Relation
## Отношения

There are 4 kind of relationship.
Есть 4 вида отношений.

```go
const (
Expand Down Expand Up @@ -36,7 +36,7 @@ type CreditCard struct {
}
```

GEN will detect model's associations:
GEN обнаружит обратные ссылки:

```go
// specify model
Expand Down
4 changes: 4 additions & 0 deletions pages/ru_RU/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 4 additions & 0 deletions pages/tr_TR/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
Expand Down
4 changes: 2 additions & 2 deletions pages/zh_CN/docs/context.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Context
title: 上下文
layout: page
---

GORM's context support, enabled by the `WithContext` method, is a powerful feature that enhances the flexibility and control of database operations in Go applications. It allows for context management across different operational modes, timeout settings, and even integration into hooks/callbacks and middlewares. Let's delve into these various aspects:
GORM 的上下文支持由 `WithContext` 方法启用,是一项强大的功能,可以增强 Go 应用程序中数据库操作的灵活性和控制力。 它允许在不同的操作模式、超时设置以及甚至集成到钩子/回调和中间件中进行上下文管理。 让我们从不同方面深入了解:

### 单会话模式

Expand Down
33 changes: 19 additions & 14 deletions pages/zh_CN/gen/database_to_structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,35 @@ import "gorm.io/gen"
func main() {
g := gen.NewGenerator(gen.Config{
OutPath: "../query",
Mode: gen.WithoutContext|gen.WithDefaultQuery|gen.WithQueryInterface, // 生成模式
Mode: gen.WithoutContext|gen.WithDefaultQuery|gen.WithQueryInterface, // generate mode
})

// gormdb, _ := gorm.Open(mysql.Open("root:@(127.0.0.1:3306)/demo?charset=utf8mb4&parseTime=True&loc=Local"))
g.UseDB(gormdb) // reuse your gorm db

// 按照约定为结构体 `model.User` 生成类型安全的 DAO API
// Generate basic type-safe DAO API for struct `model.User` following conventions

g.ApplyBasic(
// 根据 `user` 表生成结构 `User`
g.GenerateModel("users"),
// Generate struct `User` based on table `users`
g.GenerateModel("users"),

// 根据 `user` 表生成结构 `Employee`
g.GenerateModelAs("users", "Employee"),
// Generate struct `Employee` based on table `users`
g.GenerateModelAs("users", "Employee"),

// 根据 `user` 表和生成时选项生成结构 `User`
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),
)

g.ApplyBasic(
// 从当前数据库中生成所有表的结构
g.GenerateAllTable()...,
)
// Generate struct `User` based on table `users` and generating options
g.GenerateModel("users", gen.FieldIgnore("address"), gen.FieldType("id", "int64")),

// 生成代码
// Generate struct `Customer` based on table `customer` and generating options
// customer table may have a tags column, it can be JSON type, gorm/gen tool can generate for your JSON data type
g.GenerateModel("customer", gen.FieldType("tags", "datatypes.JSON")),

)
g.ApplyBasic(
// Generate structs from all tables of current database
g.GenerateAllTable()...,
)
// Generate the code
g.Execute()
}

Expand Down

0 comments on commit fed7b64

Please sign in to comment.