docs(comments): 注释中文化 · internal/runtime/memory(31 文件,纯替换)
- 只翻注释/文档字符串:820 增 / 820 删 严格 1:1;剥掉整行注释与行尾注释尾巴后, 逐文件与 HEAD 比对「代码部分差异 = 0」;裁决/design 编号计数逐项与 HEAD 一致 - 保留可执行 SQL 样例、SQLite 报错原文、pgvector/HNSW/ANN/BLOB 等技术词原文 - 复核:go build 绿 + memory/projectindex/vector 三包测试绿;gofmt 仅剩 2 个既有未格式化文件(改动前即如此,未顺手修)
This commit is contained in:
1 parent
eb1828ee7a
commit
61cf80d5ee
31 files changed
+820
-820
No files matched your search
@@ -7,10 +7,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Chapter is a project chapter (layer 3 of the hierarchy): the deep content a
|
||||
// project is split into. ProjectID links it to the owning project. The zero
|
||||
// value is not a valid chapter: AddChapter requires a non-blank title and
|
||||
// content, and generates the id.
|
||||
// Chapter 是一个项目章节(层级第 3 层):项目被切分成的
|
||||
// 深层内容。ProjectID 把它链到所属项目。零值
|
||||
// 不是合法章节:AddChapter 要求 title 与
|
||||
// content 非空,并生成 id。
|
||||
type Chapter struct {
|
||||
ID string
|
||||
ProjectID string
|
||||
@@ -20,11 +20,11 @@ type Chapter struct {
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
// AddChapter persists ch under projectID, assigning an id and missing
|
||||
// timestamps. It requires a non-blank projectID, title and content; a blank id
|
||||
// is generated. The project row itself does not have to exist, so chapters may
|
||||
// be added before or after their parent project, but DeleteProject cascades
|
||||
// them away together.
|
||||
// AddChapter 以 projectID 持久化 ch,分配 id 与缺失的
|
||||
// 时间戳。它要求 projectID、title 与 content 非空;id 为空时
|
||||
// 自动生成。项目行本身不必存在,因此章节可以在其父项目
|
||||
// 之前或之后添加,但 DeleteProject 会把它们一并级联
|
||||
// 删除。
|
||||
func (s *Store) AddChapter(ctx context.Context, projectID string, ch Chapter) error {
|
||||
if strings.TrimSpace(projectID) == "" {
|
||||
return ErrMissingProject
|
||||
@@ -61,11 +61,11 @@ func (s *Store) AddChapter(ctx context.Context, projectID string, ch Chapter) er
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListChapters returns every chapter for projectID in insertion order
|
||||
// (created_at ASC, rowid ASC) — rowid breaks created_at ties so chapters written
|
||||
// within the same clock tick keep their insertion order. It returns an empty
|
||||
// (non-nil) slice when there are none; a blank projectID returns
|
||||
// ErrMissingProject.
|
||||
// ListChapters 按插入顺序(created_at ASC、rowid ASC)返回 projectID 的每个
|
||||
// 章节 —— rowid 打破 created_at 并列,使同一时钟刻内写入的章节
|
||||
// 保持其插入顺序。没有条目时返回空的
|
||||
// (非 nil)切片;projectID 为空返回
|
||||
// ErrMissingProject。
|
||||
func (s *Store) ListChapters(ctx context.Context, projectID string) ([]Chapter, error) {
|
||||
if strings.TrimSpace(projectID) == "" {
|
||||
return nil, ErrMissingProject
|
||||
@@ -92,7 +92,7 @@ func (s *Store) ListChapters(ctx context.Context, projectID string) ([]Chapter,
|
||||
return chapters, nil
|
||||
}
|
||||
|
||||
// scanChapter reads one project_chapter row.
|
||||
// scanChapter 读取一行 project_chapter。
|
||||
func scanChapter(sc rowScanner) (Chapter, error) {
|
||||
var (
|
||||
ch Chapter
|
||||
|
||||
Reference in new issue
Block a user