✨Feat: 定义card结构体
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package agent
|
||||
|
||||
// Card 是顶层结构体,包含所有关于 Go map 的笔记内容
|
||||
type Card struct {
|
||||
Summary string `json:"summary"`
|
||||
KeyPoints KeyPoints `json:"key_points"`
|
||||
CommonMisconceptions CommonMisconceptions `json:"common_misconceptions"`
|
||||
BestPractices BestPractices `json:"best_practices"`
|
||||
Mnemonic Mnemonic `json:"mnemonic"`
|
||||
}
|
||||
|
||||
// KeyPoints 包含关键要点部分
|
||||
type KeyPoints struct {
|
||||
Header string `json:"header"`
|
||||
Items []KeyPointItem `json:"items"`
|
||||
}
|
||||
|
||||
// KeyPointItem 是关键要点的单个条目
|
||||
type KeyPointItem struct {
|
||||
Point string `json:"point"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// CommonMisconceptions 包含常见误区部分
|
||||
type CommonMisconceptions struct {
|
||||
Header string `json:"header"`
|
||||
Items []MisconceptionItem `json:"items"`
|
||||
}
|
||||
|
||||
// MisconceptionItem 是常见误区的单个条目
|
||||
type MisconceptionItem struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Detail string `json:"detail"`
|
||||
Fix string `json:"fix"`
|
||||
}
|
||||
|
||||
// BestPractices 包含最佳实践部分
|
||||
type BestPractices struct {
|
||||
Header string `json:"header"`
|
||||
Items []PracticeItem `json:"items"`
|
||||
}
|
||||
|
||||
// PracticeItem 是最佳实践的单个条目
|
||||
type PracticeItem struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Detail string `json:"detail"`
|
||||
CorrectExample string `json:"correct_example,omitempty"` // 可能不存在于某些条目
|
||||
IncorrectExample string `json:"incorrect_example,omitempty"` // 可能不存在于某些条目
|
||||
}
|
||||
|
||||
// Mnemonic 包含记忆口诀部分
|
||||
type Mnemonic struct {
|
||||
Header string `json:"header"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// 使用示例:
|
||||
// var card Card
|
||||
// err := json.Unmarshal(data, &card)
|
||||
// 或
|
||||
// wrapper := struct {
|
||||
// Card Card `json:"card"`
|
||||
// }{}
|
||||
// err := json.Unmarshal(data, &wrapper)
|
||||
Reference in New Issue
Block a user