mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: store migrator
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user