2024-07-19 13:28:48 +00:00
|
|
|
package otter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-07-19 19:57:01 +00:00
|
|
|
"git.anthrove.art/anthrove/otter-space-sdk/v2/pkg/database"
|
|
|
|
"git.anthrove.art/anthrove/otter-space-sdk/v2/pkg/models"
|
2024-07-19 13:28:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func ConnectToDatabase(ctx context.Context, config models.DatabaseConfig) (database.OtterSpace, error) {
|
|
|
|
var otterSpace database.OtterSpace
|
|
|
|
var err error
|
|
|
|
|
|
|
|
otterSpace = database.NewPostgresqlConnection()
|
|
|
|
err = otterSpace.Connect(ctx, config)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return otterSpace, err
|
|
|
|
}
|