Files
memoryweave/go/internal/api/server_sqlite_nowindows.go
T
小唯 886c0c20e2 style(gofmt): 全仓 66 文件对齐 gofmt 1.25
gofmt -l 实测 66 文件不合规(历史遗留+gofmt 1.25 规范化:
单行 if/for/case 展开成块、Go1.19+ doc 注释 // 与段落 // 空行)。
本 commit 只含格式化,零逻辑改动:
- 66/66 文件「去注释+去空白+分号归一」后 token 流与 HEAD 完全一致
- go build ./... exit 0;go vet ./... exit 0(改前后一致)
- go test ./... 17 包全 ok(改前后一致)
验收: gofmt -l . 为空;git diff -w 非空系 gofmt 1.25 非纯空白特性,
非逻辑改动(等价性以 token 流 + test 兜底)。
2026-10-10 15:51:25 +08:00

27 lines
723 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//go:build !windows
// 织忆 MemoryWeave — SQLite 存储后端初始化(非 Windows)
package api
import (
"log"
"os"
"github.com/xiaoxue/memoryweave/internal/storage"
)
// initStorageForSQLite 初始化 SQLite 存储后端(仅非 Windows)
func initStorageForSQLite(emb *storage.Embedder) storage.LanceDB {
dbPath := "/var/lib/memoryweave/zhiyi.db"
if envPath := os.Getenv("SQLITE_PATH"); envPath != "" {
dbPath = envPath
}
sqliteDB, err := storage.NewSQLiteClient(dbPath)
if err != nil {
log.Printf("[zhiyid] SQLite 初始化失败 (%v),降级为内存存储", err)
return storage.NewMemLanceClient(emb)
}
log.Printf("[zhiyid] 存储后端: SQLite (CGO) — %s", dbPath)
return sqliteDB
}