pkgdash/storage/storage.go

33 lines
603 B
Go
Raw Normal View History

package storage
import (
"context"
"database/sql"
"embed"
"go.unistack.org/unistack-org/pkgdash/models"
"go.unistack.org/unistack-org/pkgdash/storage/postgres"
cmsstorage "go.unistack.org/cms-service/storage"
)
//go:embed migrations
var fs embed.FS
var (
storages = cmsstorage.NewStorageInterface()
)
func init() {
storages.RegisterStorage("postgres", postgres.NewStorageFS(fs))
}
type Storage interface {
cmsstorage.Migrator
List(ctx context.Context) ([]*models.Package, error)
}
func NewStorage(name string, db *sql.DB) (interface{}, error) {
return storages.NewStorage(name, db)
}