SDK v3 #8

Merged
SoXX merged 77 commits from dev/issue-5 into main 2024-08-14 13:27:35 +00:00
Showing only changes of commit e839e7ba2a - Show all commits

View File

@ -4,6 +4,7 @@ import (
"context"
"embed"
"fmt"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v2/pkg/error"
"git.anthrove.art/Anthrove/otter-space-sdk/v2/pkg/models"
migrate "github.com/rubenv/sql-migrate"
log "github.com/sirupsen/logrus"
@ -66,3 +67,11 @@ func migrateDatabase(dbPool *gorm.DB, config models.DatabaseConfig) error {
return nil
}
func GetGorm(ctx context.Context) (*gorm.DB, error) {
if client == nil {
return nil, &otterError.Database{Reason: otterError.DatabaseIsNotConnected}
}
return client, nil
}