refactor(model): 重构数据模型结构
- 将 Word 和 MemoryRecord 结构体拆分为独立文件 - 创建 request 包用于存放请求结构体 - 创建 response 包用于存放响应结构体 - 将 YoudaoResponse 移至独立模型文件 - 更新服务层接口参数类型为新的请求响应结构体 - 修改处理器层导入路径以使用新包结构
This commit is contained in:
21
memora-api/internal/model/word.go
Normal file
21
memora-api/internal/model/word.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Word struct {
|
||||
ID int64 `json:"id" gorm:"primaryKey"`
|
||||
Word string `json:"word" gorm:"size:100;uniqueIndex;not null"`
|
||||
PhoneticUK string `json:"phonetic_uk" gorm:"size:255"`
|
||||
PhoneticUS string `json:"phonetic_us" gorm:"size:255"`
|
||||
AudioUK string `json:"audio_uk" gorm:"size:500"`
|
||||
AudioUS string `json:"audio_us" gorm:"size:500"`
|
||||
PartOfSpeech string `json:"part_of_speech" gorm:"size:50"`
|
||||
Definition string `json:"definition" gorm:"type:text"`
|
||||
ExampleSentence string `json:"example_sentence" gorm:"type:text"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (Word) TableName() string {
|
||||
return "words"
|
||||
}
|
||||
Reference in New Issue
Block a user