This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
plug-sdk/pkg/otter/connect.go

21 lines
462 B
Go
Raw Normal View History

2024-02-20 18:11:34 +00:00
package otter
import (
"context"
2024-07-06 22:26:24 +00:00
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/database"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
2024-02-20 18:11:34 +00:00
)
2024-07-06 22:26:24 +00:00
func ConnectToDatabase(ctx context.Context, config models.DatabaseConfig) (database.OtterSpace, error) {
var otterSpace database.OtterSpace
2024-02-20 18:11:34 +00:00
var err error
2024-07-06 22:26:24 +00:00
otterSpace = database.NewPostgresqlConnection()
err = otterSpace.Connect(ctx, config)
2024-02-20 18:11:34 +00:00
if err != nil {
return nil, err
}
2024-07-06 22:26:24 +00:00
return otterSpace, err
2024-02-20 18:11:34 +00:00
}