cms-template/storage/storage.go

30 lines
577 B
Go
Raw Normal View History

package storage
import (
"context"
"database/sql"
"embed"
store "go.unistack.org/cms-service/storage"
"go.unistack.org/cms-template/storage/sqlite"
)
//go:embed all:migrations
var fs embed.FS
var storages = store.NewStorageInterface()
func init() {
storages.RegisterStorage("sqlite", sqlite.NewStorageSqlite(fs))
}
type Storage interface {
Auth(ctx context.Context, login, passw string) error
Delete(ctx context.Context, uuid string) error
store.Migrator
}
func NewStorage(name string, db *sql.DB) (interface{}, error) {
return storages.NewStorage(name, db)
}