Skip to content

Commit

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

* New translations models.md (Portuguese, Brazilian)

* New translations migration.md (Korean)

* New translations migration.md (Korean)

* 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)

* Update source file community.md

* New translations migration.md (Korean)

* New translations write_plugins.md (Chinese Simplified)

* New translations associations.md (Chinese Simplified)

* New translations community.md (French)

* New translations belongs_to.md (French)

* New translations models.md (French)

* New translations sharding.md (French)

* New translations community.md (Spanish)

* New translations belongs_to.md (Spanish)

* New translations models.md (Spanish)

* New translations sharding.md (Spanish)

* New translations community.md (Arabic)

* New translations belongs_to.md (Arabic)

* New translations models.md (Arabic)

* New translations sharding.md (Arabic)

* New translations community.md (German)

* New translations belongs_to.md (German)

* New translations models.md (German)

* New translations sharding.md (German)

* New translations community.md (Italian)

* New translations belongs_to.md (Italian)

* New translations models.md (Italian)

* New translations sharding.md (Italian)

* New translations community.md (Japanese)

* New translations belongs_to.md (Japanese)

* New translations models.md (Japanese)

* New translations sharding.md (Japanese)

* New translations community.md (Korean)

* New translations belongs_to.md (Korean)

* New translations models.md (Korean)

* New translations sharding.md (Korean)

* New translations community.md (Polish)

* New translations belongs_to.md (Polish)

* New translations models.md (Polish)

* New translations sharding.md (Polish)

* New translations community.md (Russian)

* New translations belongs_to.md (Russian)

* New translations models.md (Russian)

* New translations sharding.md (Russian)

* New translations community.md (Turkish)

* New translations belongs_to.md (Turkish)

* New translations models.md (Turkish)

* New translations sharding.md (Turkish)

* New translations community.md (Chinese Simplified)

* New translations belongs_to.md (Chinese Simplified)

* New translations models.md (Chinese Simplified)

* New translations sharding.md (Chinese Simplified)

* New translations community.md (Portuguese, Brazilian)

* New translations belongs_to.md (Portuguese, Brazilian)

* New translations models.md (Portuguese, Brazilian)

* New translations sharding.md (Portuguese, Brazilian)

* New translations community.md (Indonesian)

* New translations belongs_to.md (Indonesian)

* New translations models.md (Indonesian)

* New translations sharding.md (Indonesian)

* New translations community.md (Persian)

* New translations belongs_to.md (Persian)

* New translations models.md (Persian)

* New translations sharding.md (Persian)

* New translations community.md (Azerbaijani)

* New translations belongs_to.md (Azerbaijani)

* New translations models.md (Azerbaijani)

* New translations sharding.md (Azerbaijani)

* New translations community.md (Hindi)

* New translations belongs_to.md (Hindi)

* New translations models.md (Hindi)

* New translations sharding.md (Hindi)

* Update source file community.md

* Update source file belongs_to.md

* Update source file models.md

* Update source file sharding.md

* 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)

* Update source file community.md
  • Loading branch information
jinzhu authored Nov 21, 2024
1 parent 715e1d2 commit 21e26ee
Show file tree
Hide file tree
Showing 67 changed files with 294 additions and 272 deletions.
4 changes: 4 additions & 0 deletions pages/ar_SA/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ layout: page

* [Using GORM concurrently is not safe](https://zhuanlan.zhihu.com/p/556065676)

* A multi-tenant iot platform based on gorm - [联犀](https://github.com/unitedrhino/things)

## Videos

* Gorm quick start tutorial by [piexlmax](https://github.com/piexlmax) - [GORM V2 quick start](https://www.bilibili.com/video/BV1E64y1472a#reply5032293079)
Expand All @@ -45,6 +47,8 @@ layout: page
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)
* [immugorm - GORM immudb driver](https://github.com/codenotary/immugorm)
* [DuckDB- GORM DuckDB driver](https://github.com/alifiroozi80/duckdb)
* [gorm4gaussdb - GORM GaussDB Driver](https://github.com/okyer/gorm4gaussdb)

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

Expand Down
2 changes: 1 addition & 1 deletion pages/ar_SA/docs/belongs_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type Company struct {
type User struct {
gorm.Model
Name string
CompanyID string
CompanyID int
Company Company `gorm:"references:CompanyID"` // use Company.CompanyID as references
}

Expand Down
2 changes: 2 additions & 0 deletions pages/ar_SA/docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type User struct {
ActivatedAt sql.NullTime // Uses sql.NullTime for nullable time fields
CreatedAt time.Time // Automatically managed by GORM for creation time
UpdatedAt time.Time // Automatically managed by GORM for update time
ignored string // fields that aren't exported are ignored
}
```

Expand All @@ -31,6 +32,7 @@ In this model:
- Pointers to types like `*string` and `*time.Time` indicate nullable fields.
- `sql.NullString` and `sql.NullTime` from the `database/sql` package are used for nullable fields with more control.
- `CreatedAt` and `UpdatedAt` are special fields that GORM automatically populates with the current time when a record is created or updated.
- Non-exported fields (starting with a small letter) are not mapped

In addition to the fundamental features of model declaration in GORM, it's important to highlight the support for serialization through the serializer tag. This feature enhances the flexibility of how data is stored and retrieved from the database, especially for fields that require custom serialization logic, See [Serializer](serializer.html) for a detailed explanation

Expand Down
15 changes: 5 additions & 10 deletions pages/ar_SA/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ https://github.com/go-gorm/sharding

- Non-intrusive design. Load the plugin, specify the config, and all done.
- Lighting-fast. No network based middlewares, as fast as Go.
- Multiple database support. PostgreSQL tested, MySQL and SQLite is coming.
- Allows you custom the Primary Key generator (Built in keygen, Sequence, Snowflake ...).
- Multiple database (PostgreSQL, MySQL) support.
- Integrated primary key generator (Snowflake, PostgreSQL Sequence, Custom, ...).

## Usage

Expand All @@ -27,19 +27,14 @@ import (
"gorm.io/sharding"
)

dsn := "postgres://localhost:5432/sharding-db?sslmode=disable"
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dsn}))
db, err := gorm.Open(postgres.New(postgres.Config{DSN: "postgres://localhost:5432/sharding-db?sslmode=disable"))

db.Use(sharding.Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 64,
PrimaryKeyGenerator: sharding.PKSnowflake,
}, "orders").Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 256,
PrimaryKeyGenerator: sharding.PKSnowflake,
// This case for show up give notifications, audit_logs table use same sharding rule.
}, Notification{}, AuditLog{}))
}, "orders", Notification{}, AuditLog{}))
// This case for show up give notifications, audit_logs table use same sharding rule.
```
Use the db session as usual. Just note that the query should have the `Sharding Key` when operate sharding tables.
Expand Down
4 changes: 4 additions & 0 deletions pages/az_AZ/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ layout: page

* [Using GORM concurrently is not safe](https://zhuanlan.zhihu.com/p/556065676)

* A multi-tenant iot platform based on gorm - [联犀](https://github.com/unitedrhino/things)

## Videos

* Gorm quick start tutorial by [piexlmax](https://github.com/piexlmax) - [GORM V2 quick start](https://www.bilibili.com/video/BV1E64y1472a#reply5032293079)
Expand All @@ -45,6 +47,8 @@ layout: page
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)
* [immugorm - GORM immudb driver](https://github.com/codenotary/immugorm)
* [DuckDB- GORM DuckDB driver](https://github.com/alifiroozi80/duckdb)
* [gorm4gaussdb - GORM GaussDB Driver](https://github.com/okyer/gorm4gaussdb)

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

Expand Down
2 changes: 1 addition & 1 deletion pages/az_AZ/docs/belongs_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Company struct {
type User struct {
gorm.Model
Name string
CompanyID string
CompanyID int
Company Company `gorm:"references:CompanyID"` // use Company.CompanyID as references
}

Expand Down
2 changes: 2 additions & 0 deletions pages/az_AZ/docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type User struct {
ActivatedAt sql.NullTime // Uses sql.NullTime for nullable time fields
CreatedAt time.Time // Automatically managed by GORM for creation time
UpdatedAt time.Time // Automatically managed by GORM for update time
ignored string // fields that aren't exported are ignored
}
```

Expand All @@ -31,6 +32,7 @@ In this model:
- Pointers to types like `*string` and `*time.Time` indicate nullable fields.
- `sql.NullString` and `sql.NullTime` from the `database/sql` package are used for nullable fields with more control.
- `CreatedAt` and `UpdatedAt` are special fields that GORM automatically populates with the current time when a record is created or updated.
- Non-exported fields (starting with a small letter) are not mapped

In addition to the fundamental features of model declaration in GORM, it's important to highlight the support for serialization through the serializer tag. This feature enhances the flexibility of how data is stored and retrieved from the database, especially for fields that require custom serialization logic, See [Serializer](serializer.html) for a detailed explanation

Expand Down
15 changes: 5 additions & 10 deletions pages/az_AZ/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ https://github.com/go-gorm/sharding

- Non-intrusive design. Load the plugin, specify the config, and all done.
- Lighting-fast. No network based middlewares, as fast as Go.
- Multiple database support. PostgreSQL tested, MySQL and SQLite is coming.
- Allows you custom the Primary Key generator (Built in keygen, Sequence, Snowflake ...).
- Multiple database (PostgreSQL, MySQL) support.
- Integrated primary key generator (Snowflake, PostgreSQL Sequence, Custom, ...).

## Usage

Expand All @@ -27,19 +27,14 @@ import (
"gorm.io/sharding"
)

dsn := "postgres://localhost:5432/sharding-db?sslmode=disable"
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dsn}))
db, err := gorm.Open(postgres.New(postgres.Config{DSN: "postgres://localhost:5432/sharding-db?sslmode=disable"))

db.Use(sharding.Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 64,
PrimaryKeyGenerator: sharding.PKSnowflake,
}, "orders").Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 256,
PrimaryKeyGenerator: sharding.PKSnowflake,
// This case for show up give notifications, audit_logs table use same sharding rule.
}, Notification{}, AuditLog{}))
}, "orders", Notification{}, AuditLog{}))
// This case for show up give notifications, audit_logs table use same sharding rule.
```
Use the db session as usual. Just note that the query should have the `Sharding Key` when operate sharding tables.
Expand Down
4 changes: 4 additions & 0 deletions pages/de_DE/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ layout: page

* [Using GORM concurrently is not safe](https://zhuanlan.zhihu.com/p/556065676)

* A multi-tenant iot platform based on gorm - [联犀](https://github.com/unitedrhino/things)

## Videos

* Gorm quick start tutorial by [piexlmax](https://github.com/piexlmax) - [GORM V2 quick start](https://www.bilibili.com/video/BV1E64y1472a#reply5032293079)
Expand All @@ -45,6 +47,8 @@ layout: page
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)
* [immugorm - GORM immudb driver](https://github.com/codenotary/immugorm)
* [DuckDB- GORM DuckDB driver](https://github.com/alifiroozi80/duckdb)
* [gorm4gaussdb - GORM GaussDB Driver](https://github.com/okyer/gorm4gaussdb)

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

Expand Down
2 changes: 1 addition & 1 deletion pages/de_DE/docs/belongs_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Company struct {
type User struct {
gorm.Model
Name string
CompanyID string
CompanyID int
Company Company `gorm:"references:CompanyID"` // use Company.CompanyID as references
}

Expand Down
2 changes: 2 additions & 0 deletions pages/de_DE/docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type User struct {
ActivatedAt sql.NullTime // Uses sql.NullTime for nullable time fields
CreatedAt time.Time // Automatically managed by GORM for creation time
UpdatedAt time.Time // Automatically managed by GORM for update time
ignored string // fields that aren't exported are ignored
}
```

Expand All @@ -31,6 +32,7 @@ In this model:
- Pointers to types like `*string` and `*time.Time` indicate nullable fields.
- `sql.NullString` and `sql.NullTime` from the `database/sql` package are used for nullable fields with more control.
- `CreatedAt` and `UpdatedAt` are special fields that GORM automatically populates with the current time when a record is created or updated.
- Non-exported fields (starting with a small letter) are not mapped

In addition to the fundamental features of model declaration in GORM, it's important to highlight the support for serialization through the serializer tag. This feature enhances the flexibility of how data is stored and retrieved from the database, especially for fields that require custom serialization logic, See [Serializer](serializer.html) for a detailed explanation

Expand Down
15 changes: 5 additions & 10 deletions pages/de_DE/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ https://github.com/go-gorm/sharding

- Non-intrusive design. Load the plugin, specify the config, and all done.
- Lighting-fast. No network based middlewares, as fast as Go.
- Multiple database support. PostgreSQL tested, MySQL and SQLite is coming.
- Allows you custom the Primary Key generator (Built in keygen, Sequence, Snowflake ...).
- Multiple database (PostgreSQL, MySQL) support.
- Integrated primary key generator (Snowflake, PostgreSQL Sequence, Custom, ...).

## Usage

Expand All @@ -27,19 +27,14 @@ import (
"gorm.io/sharding"
)

dsn := "postgres://localhost:5432/sharding-db?sslmode=disable"
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dsn}))
db, err := gorm.Open(postgres.New(postgres.Config{DSN: "postgres://localhost:5432/sharding-db?sslmode=disable"))

db.Use(sharding.Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 64,
PrimaryKeyGenerator: sharding.PKSnowflake,
}, "orders").Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 256,
PrimaryKeyGenerator: sharding.PKSnowflake,
// This case for show up give notifications, audit_logs table use same sharding rule.
}, Notification{}, AuditLog{}))
}, "orders", Notification{}, AuditLog{}))
// This case for show up give notifications, audit_logs table use same sharding rule.
```
Use the db session as usual. Just note that the query should have the `Sharding Key` when operate sharding tables.
Expand Down
4 changes: 4 additions & 0 deletions pages/es_ES/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ layout: page

* [El uso simultáneo de GORM no es seguro](https://zhuanlan.zhihu.com/p/556065676)

* A multi-tenant iot platform based on gorm - [联犀](https://github.com/unitedrhino/things)

## Vídeos

* Gorm tutorial de inicio rápido por [piexlmax](https://github.com/piexlmax) - [GORM V2 quick start](https://www.bilibili.com/video/BV1E64y1472a#reply5032293079)
Expand All @@ -45,6 +47,8 @@ layout: page
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)
* [immugorm - GORM immudb driver](https://github.com/codenotary/immugorm)
* [DuckDB- GORM DuckDB driver](https://github.com/alifiroozi80/duckdb)
* [gorm4gaussdb - GORM GaussDB Driver](https://github.com/okyer/gorm4gaussdb)

## <span id="contribute">Contribuye a esta página</span>

Expand Down
2 changes: 1 addition & 1 deletion pages/es_ES/docs/belongs_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Company struct {
type User struct {
gorm.Model
Name string
CompanyID string
CompanyID int
Company Company `gorm:"references:CompanyID"` // use Company.CompanyID as references
}

Expand Down
2 changes: 2 additions & 0 deletions pages/es_ES/docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type User struct {
ActivatedAt sql.NullTime // Uses sql.NullTime for nullable time fields
CreatedAt time.Time // Automatically managed by GORM for creation time
UpdatedAt time.Time // Automatically managed by GORM for update time
ignored string // fields that aren't exported are ignored
}
```

Expand All @@ -31,6 +32,7 @@ In this model:
- Pointers to types like `*string` and `*time.Time` indicate nullable fields.
- `sql.NullString` and `sql.NullTime` from the `database/sql` package are used for nullable fields with more control.
- `CreatedAt` and `UpdatedAt` are special fields that GORM automatically populates with the current time when a record is created or updated.
- Non-exported fields (starting with a small letter) are not mapped

In addition to the fundamental features of model declaration in GORM, it's important to highlight the support for serialization through the serializer tag. This feature enhances the flexibility of how data is stored and retrieved from the database, especially for fields that require custom serialization logic, See [Serializer](serializer.html) for a detailed explanation

Expand Down
15 changes: 5 additions & 10 deletions pages/es_ES/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ https://github.com/go-gorm/sharding

- Non-intrusive design. Load the plugin, specify the config, and all done.
- Lighting-fast. No network based middlewares, as fast as Go.
- Multiple database support. PostgreSQL tested, MySQL and SQLite is coming.
- Allows you custom the Primary Key generator (Built in keygen, Sequence, Snowflake ...).
- Multiple database (PostgreSQL, MySQL) support.
- Integrated primary key generator (Snowflake, PostgreSQL Sequence, Custom, ...).

## Usage

Expand All @@ -27,19 +27,14 @@ import (
"gorm.io/sharding"
)

dsn := "postgres://localhost:5432/sharding-db?sslmode=disable"
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dsn}))
db, err := gorm.Open(postgres.New(postgres.Config{DSN: "postgres://localhost:5432/sharding-db?sslmode=disable"))

db.Use(sharding.Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 64,
PrimaryKeyGenerator: sharding.PKSnowflake,
}, "orders").Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 256,
PrimaryKeyGenerator: sharding.PKSnowflake,
// This case for show up give notifications, audit_logs table use same sharding rule.
}, Notification{}, AuditLog{}))
}, "orders", Notification{}, AuditLog{}))
// This case for show up give notifications, audit_logs table use same sharding rule.
```
Use the db session as usual. Just note that the query should have the `Sharding Key` when operate sharding tables.
Expand Down
4 changes: 4 additions & 0 deletions pages/fa_IR/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ layout: صفحه

* [استفاده از همزمانی در GORM ایمن نیست](https://zhuanlan.zhihu.com/p/556065676)

* A multi-tenant iot platform based on gorm - [联犀](https://github.com/unitedrhino/things)

## ویدیوها

* آموزش شروع سریع Gorm توسط [piexlmax](https://github.com/piexlmax) - [GORM V2 quick start](https://www.bilibili.com/video/BV1E64y1472a#reply5032293079)
Expand All @@ -45,6 +47,8 @@ layout: صفحه
* [Go ORM Helper - GORM Code Completion Goland Plugin](https://github.com/maiqingqiang/go-orm-helper)
* [dynmgrm - GORM DynamoDB Driver](https://github.com/miyamo2/dynmgrm)
* [immugorm - GORM immudb driver](https://github.com/codenotary/immugorm)
* [DuckDB- GORM DuckDB driver](https://github.com/alifiroozi80/duckdb)
* [gorm4gaussdb - GORM GaussDB Driver](https://github.com/okyer/gorm4gaussdb)

## <span id="contribute">مشارکت در بهبود این صفحه</span>

Expand Down
2 changes: 1 addition & 1 deletion pages/fa_IR/docs/belongs_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Company struct {
type User struct {
gorm.Model
Name string
CompanyID string
CompanyID int
Company Company `gorm:"references:CompanyID"` // use Company.CompanyID as references
}

Expand Down
2 changes: 2 additions & 0 deletions pages/fa_IR/docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type User struct {
ActivatedAt sql.NullTime // Uses sql.NullTime for nullable time fields
CreatedAt time.Time // Automatically managed by GORM for creation time
UpdatedAt time.Time // Automatically managed by GORM for update time
ignored string // fields that aren't exported are ignored
}
```

Expand All @@ -31,6 +32,7 @@ In this model:
- Pointers to types like `*string` and `*time.Time` indicate nullable fields.
- `sql.NullString` and `sql.NullTime` from the `database/sql` package are used for nullable fields with more control.
- `CreatedAt` and `UpdatedAt` are special fields that GORM automatically populates with the current time when a record is created or updated.
- Non-exported fields (starting with a small letter) are not mapped

In addition to the fundamental features of model declaration in GORM, it's important to highlight the support for serialization through the serializer tag. This feature enhances the flexibility of how data is stored and retrieved from the database, especially for fields that require custom serialization logic, See [Serializer](serializer.html) for a detailed explanation

Expand Down
15 changes: 5 additions & 10 deletions pages/fa_IR/docs/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ https://github.com/go-gorm/sharding

- Non-intrusive design. Load the plugin, specify the config, and all done.
- Lighting-fast. No network based middlewares, as fast as Go.
- Multiple database support. PostgreSQL tested, MySQL and SQLite is coming.
- Allows you custom the Primary Key generator (Built in keygen, Sequence, Snowflake ...).
- Multiple database (PostgreSQL, MySQL) support.
- Integrated primary key generator (Snowflake, PostgreSQL Sequence, Custom, ...).

## Usage

Expand All @@ -27,19 +27,14 @@ import (
"gorm.io/sharding"
)

dsn := "postgres://localhost:5432/sharding-db?sslmode=disable"
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dsn}))
db, err := gorm.Open(postgres.New(postgres.Config{DSN: "postgres://localhost:5432/sharding-db?sslmode=disable"))

db.Use(sharding.Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 64,
PrimaryKeyGenerator: sharding.PKSnowflake,
}, "orders").Register(sharding.Config{
ShardingKey: "user_id",
NumberOfShards: 256,
PrimaryKeyGenerator: sharding.PKSnowflake,
// This case for show up give notifications, audit_logs table use same sharding rule.
}, Notification{}, AuditLog{}))
}, "orders", Notification{}, AuditLog{}))
// This case for show up give notifications, audit_logs table use same sharding rule.
```
Use the db session as usual. Just note that the query should have the `Sharding Key` when operate sharding tables.
Expand Down
Loading

0 comments on commit 21e26ee

Please sign in to comment.