WIP/init
This commit is contained in:
24
init_db.go
Normal file
24
init_db.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package outbox
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
_ "embed"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrMigrate = errors.New("error creating outbox table")
|
||||
)
|
||||
|
||||
//go:embed init_db.sql
|
||||
var initStatement string
|
||||
|
||||
func initDB(ctx context.Context, db *sql.DB, tablename string) error {
|
||||
_, err := db.ExecContext(ctx, initStatement, tablename)
|
||||
if err != nil {
|
||||
return errors.Join(ErrMigrate, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user