-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andreas Lindfalk
committed
May 20, 2022
1 parent
9912f5e
commit 1c6cb30
Showing
2 changed files
with
14 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ Do also check out the [dentech-floss/pagination](https://github.com/dentech-flos | |
## Install | ||
|
||
``` | ||
go get github.com/dentech-floss/[email protected].1 | ||
go get github.com/dentech-floss/[email protected].2 | ||
``` | ||
|
||
## Usage | ||
|
@@ -43,14 +43,12 @@ func main() { | |
|
||
orm := orm.NewMySqlOrm( | ||
&orm.OrmConfig{ | ||
OnGCP: true, | ||
DbName: "clinic", | ||
DbUser: "some_user", | ||
DbPassword: "some_pwd", | ||
DbHost: "some_host", | ||
DbPort: 3306, // not mandatory to provide, will default to 3306 if not provided | ||
// this is optional, it defaults to false but shall be set to true when on Cloud Run. | ||
// See https://cloud.google.com/sql/docs/mysql/connect-run#go | ||
UseUnixSocket: true, | ||
DbPort: 3306, // not mandatory, will default to 3306 if not provided | ||
}, | ||
) | ||
|
||
|
@@ -113,7 +111,7 @@ func (r *sqlRepository) FindClinicById(ctx context.Context, clinicId int32) (*mo | |
|
||
### Migration | ||
|
||
You can get hold of the [Migrator Interface](https://gorm.io/docs/migration.html#Migrator-Interface) and the [Auto Migration](https://gorm.io/docs/migration.html#Auto-Migration) like this in order to handle schema migrations: | ||
You can get hold of the [Migrator Interface](https://gorm.io/docs/migration.html#Migrator-Interface) and for example it's [Auto Migration](https://gorm.io/docs/migration.html#Auto-Migration) like this in order to handle schema migrations: | ||
|
||
```go | ||
package example | ||
|
@@ -126,14 +124,15 @@ func main() { | |
|
||
orm := orm.NewMySqlOrm( | ||
&orm.OrmConfig{ | ||
OnGCP: true, | ||
DbName: "clinic", | ||
DbUser: "some_user", | ||
DbPassword: "some_pwd", | ||
DbHost: "some_host", | ||
}, | ||
) | ||
|
||
if err := orm.GetMigrator().AutoMigrate(&model.Clinic{}); err != nil { | ||
if err := orm.Migrator().AutoMigrate(&model.Clinic{}); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters