SDK v3 #8
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user