searcherside/core/ports/db.go
Peter Kurfer 9ea9a8f658
Some checks failed
Go build / build (push) Failing after 1m58s
feat: continue basic setup
- setup ent scheme
- add command to create users
- document API
- add helpers to create migrations
- add command to run migrations
- add basic compose file
2024-06-19 21:19:37 +02:00

34 lines
553 B
Go

package ports
import (
"context"
"ariga.io/atlas/sql/migrate"
"code.icb4dc0.de/prskr/searcherside/internal/ent"
"entgo.io/ent/dialect"
)
type Driver string
const (
DriverPostgres = Driver(dialect.Postgres)
DriverSQLite = Driver(dialect.SQLite)
)
func (t Driver) String() string {
return string(t)
}
type MigrationRequest struct {
Driver Driver
URL string
}
type RevisionReadWriter interface {
migrate.RevisionReadWriter
Client() *ent.Client
}
type Migrator interface {
Migrate(ctx context.Context, req MigrationRequest) error
}