chore(readme): Update README example to include full DatabaseConfig initialization and use database.Connect function
This commit is contained in:
parent
44bedd20a1
commit
2eeae0e5c7
28
README.md
28
README.md
@ -33,23 +33,33 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
|
||||||
|
|
||||||
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/database"
|
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/database"
|
||||||
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
|
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
cfg := models.DatabaseConfig{}
|
var err error
|
||||||
|
|
||||||
pgClient := database.NewPostgresqlConnection()
|
config := models.DatabaseConfig{
|
||||||
err := pgClient.Connect(ctx, cfg)
|
Endpoint: "",
|
||||||
if err != nil {
|
Username: "",
|
||||||
log.Panic(err)
|
Password: "",
|
||||||
|
Database: "",
|
||||||
|
Port: 5432,
|
||||||
|
SSL: false,
|
||||||
|
Timezone: "Europe/Berlin",
|
||||||
|
Debug: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = database.Connect(ctx, config)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This example creates a new client, connects to the OtterSpace API, and then the client can be used to interact with the API.
|
This example creates a new client, connects to the OtterSpace API, and then the client can be used to interact with the API.
|
||||||
|
Loading…
Reference in New Issue
Block a user