refactor: store migrator

This commit is contained in:
Steven
2024-08-16 08:07:30 +08:00
parent 1ae3afc0ba
commit 6e901fc940
82 changed files with 1494 additions and 402 deletions

View File

@ -1,13 +1,9 @@
package sqlite
import (
"context"
"database/sql"
"os"
"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
// Import the SQLite driver.
_ "modernc.org/sqlite"
@ -58,13 +54,8 @@ func (d *DB) GetDB() *sql.DB {
return d.db
}
func (d *DB) GetCurrentDBSize(context.Context) (int64, error) {
fi, err := os.Stat(d.profile.DSN)
if err != nil {
return 0, status.Errorf(codes.Internal, "failed to get file info: %v", err)
}
return fi.Size(), nil
func (d *DB) Type() string {
return "sqlite"
}
func (d *DB) Close() error {