AddEntry 添加条目到指定章节
(section MemorySection, entry *Entry)
| 152 | |
| 153 | // AddEntry 添加条目到指定章节 |
| 154 | func (pm *ProjectMemory) AddEntry(section MemorySection, entry *Entry) { |
| 155 | if pm.Sections[section] == nil { |
| 156 | pm.Sections[section] = &Section{ |
| 157 | Name: string(section), |
| 158 | Entries: []*Entry{}, |
| 159 | } |
| 160 | } |
| 161 | if entry.CreatedAt.IsZero() { |
| 162 | entry.CreatedAt = time.Now() |
| 163 | } |
| 164 | pm.Sections[section].Entries = append(pm.Sections[section].Entries, entry) |
| 165 | pm.UpdatedAt = time.Now() |
| 166 | pm.Version++ |
| 167 | } |
| 168 | |
| 169 | // GetEntries 获取指定章节的所有条目 |
| 170 | func (pm *ProjectMemory) GetEntries(section MemorySection) []*Entry { |
no outgoing calls
no test coverage detected