- db.Open: delegate to mcdsl/db.Open - db.Migrate: rewrite migrations as mcdsl/db.Migration SQL strings, delegate to mcdsl/db.Migrate; keep SchemaVersion via mcdsl - auth: thin shim wrapping mcdsl/auth.Authenticator, keeps Claims type (with Subject, AccountType, Roles) for policy engine compat; delete cache.go (handled by mcdsl/auth); add ErrForbidden - config: embed mcdsl/config.Base for standard sections (Server with Duration fields, Database, MCIAS, Log); keep StorageConfig and WebConfig as MCR-specific; use mcdsl/config.Load[T] + Validator - WriteTimeout now defaults to 30s (mcdsl default, was 0) - All existing tests pass (auth tests rewritten for new shim API, cache expiry test removed — caching tested in mcdsl) - Net -464 lines Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
509 B
Go
25 lines
509 B
Go
package db
|
|
|
|
import (
|
|
"database/sql"
|
|
"fmt"
|
|
|
|
mcdsldb "git.wntrmute.dev/kyle/mcdsl/db"
|
|
)
|
|
|
|
// DB wraps a SQLite database connection.
|
|
type DB struct {
|
|
*sql.DB
|
|
}
|
|
|
|
// Open opens (or creates) a SQLite database at the given path with the
|
|
// standard Metacircular pragmas: WAL mode, foreign keys, busy timeout.
|
|
// The file is created with 0600 permissions.
|
|
func Open(path string) (*DB, error) {
|
|
sqlDB, err := mcdsldb.Open(path)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("db: %w", err)
|
|
}
|
|
return &DB{sqlDB}, nil
|
|
}
|