feat:添加抽象话插件 (#92)

This commit is contained in:
himawari
2021-12-25 12:43:02 +08:00
committed by GitHub
parent 1d39fd8685
commit 16672d9b89
7 changed files with 117 additions and 18 deletions

View File

@@ -0,0 +1,20 @@
package chouxianghua
type Pinyin struct {
Word string `db:"word"`
Pronunciation string `db:"pronunciation"`
}
type Emoji struct {
Pronunciation string `db:"pronunciation"`
Emoji string `db:"emoji"`
}
func getPronunciationByWord(word string) (p Pinyin) {
db.Find("pinyin", &p, "where word = '"+word+"'")
return
}
func getEmojiByPronunciation(pronunciation string) (e Emoji) {
db.Find("emoji", &e, "where pronunciation = '"+pronunciation+"'")
return
}