✏️ 迁移到 utils/sql

This commit is contained in:
fumiama 2021-12-08 17:13:00 +08:00
parent e8b0e475d7
commit 10b8ab297a
2 changed files with 8 additions and 2 deletions

View File

@ -46,9 +46,14 @@ func init() {
} }
} }
} }
err := db.Create("book_review", &book{}) err := db.Create("bookreview", &book{})
if err != nil { if err != nil {
panic(err) panic(err)
} }
n, err := db.Count("bookreview")
if err != nil {
panic(err)
}
log.Printf("[bookreview]读取%d条书评", n)
}() }()
} }

View File

@ -1,7 +1,8 @@
package plugin_book_review package plugin_book_review
type book struct { type book struct {
BookReview string `db:"book_review"` Id uint64 `db:"id"`
BookReview string `db:"bookreview"`
} }
// 暂时随机选择一个书评 // 暂时随机选择一个书评