plug-sdk/pkg/otter/connect.go

21 lines
468 B
Go

package otter
import (
"context"
"git.anthrove.art/anthrove/otter-space-sdk/v2/pkg/database"
"git.anthrove.art/anthrove/otter-space-sdk/v2/pkg/models"
)
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
}