SoXX
b8e29de4fc
- Replace custom error types with string constants for common database errors. - Simplify the Database struct to include a Reason field for error messages. - Update Error method to format the error output using the Reason. - Modify validation error constants for consistency and clarity. |
||
---|---|---|
.gitea/workflows | ||
internal | ||
pkg | ||
test | ||
.gitignore | ||
go.mod | ||
go.sum | ||
README.md | ||
sonar-project.properties |
OtterSpace SDK
The OtterSpace SDK is a Go package for interacting with the OtterSpace API. It provides methods for connecting to the API, adding and linking users, posts, and sources, and retrieving information about users and posts.
Installation
To install the OtterSpace SDK, you can use go get
:
go get git.anthrove.art/Anthrove/otter-space-sdk/v2
Usage
Here's a simple usage example:
package main
import (
"context"
"log"
"git.anthrove.art/Anthrove/otter-space-sdk/v2/pkg/database"
"git.anthrove.art/Anthrove/otter-space-sdk/v2/pkg/models"
)
func main() {
ctx := context.Background()
cfg := models.DatabaseConfig{}
pgClient := database.NewPostgresqlConnection()
err := pgClient.Connect(ctx, cfg)
if err != nil {
log.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.