chore: standardize project comments in English
This commit is contained in:
1 parent
a874a39ea5
commit
ccb16acbea
167 files changed
+820
-820
No files matched your search
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Snapshot 使用 SQLite 生成一致的独立数据库,不复制活动 WAL 文件。
|
||||
// Snapshot uses SQLite to create a consistent standalone database rather than copying active WAL files.
|
||||
func (s *Store) Snapshot(ctx context.Context, dest string) error {
|
||||
_, err := s.db.ExecContext(ctx, `VACUUM INTO ?`, dest)
|
||||
return err
|
||||
@@ -34,7 +34,7 @@ func (s *Store) Preferences() (map[string]json.RawMessage, error) {
|
||||
return result, rows.Err()
|
||||
}
|
||||
|
||||
// ReplacePreferences 一次提交全部偏好,账户与会话不属于设置包。
|
||||
// ReplacePreferences commits all preferences together; accounts and sessions are excluded from settings archives.
|
||||
func (s *Store) ReplacePreferences(values map[string]json.RawMessage) error {
|
||||
tx, err := s.db.Begin()
|
||||
if err != nil {
|
||||
@@ -60,7 +60,7 @@ func (s *Store) ResetPreferences() error {
|
||||
}
|
||||
func (s *Store) ClearSessions() error { _, err := s.db.Exec(`DELETE FROM sessions`); return err }
|
||||
|
||||
// CheckBackup 确认数据库可读取且包含当前版本所需表;不会初始化或修复传入文件。
|
||||
// CheckBackup verifies readability and required tables without initializing or repairing the supplied database.
|
||||
func (s *Store) CheckBackup() error {
|
||||
var result string
|
||||
if err := s.db.QueryRow(`PRAGMA quick_check`).Scan(&result); err != nil {
|
||||
@@ -81,7 +81,7 @@ func (s *Store) CheckBackup() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// OpenExisting 只打开已有库;导入校验不得创建表或更改日志模式。
|
||||
// OpenExisting opens only existing databases; import validation must not create tables or change journal modes.
|
||||
func OpenExisting(path string) (*Store, error) {
|
||||
db, err := sql.Open("sqlite", (&url.URL{Scheme: "file", Path: path, RawQuery: "mode=rw&_pragma=busy_timeout(5000)"}).String())
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user