Rewrite some struct linkages

This commit is contained in:
2026-02-20 21:06:47 +08:00
parent 1d9407331a
commit d54f106dee
10 changed files with 228 additions and 128 deletions

View File

@@ -1,9 +1,8 @@
package cjlookup
import (
"strings"
query "github.com/tgckpg/golifehk/query"
"log"
)
func getSearchables() (*[]query.ISearchable, error) {
@@ -21,21 +20,18 @@ func getSearchables() (*[]query.ISearchable, error) {
return nil, err
}
for jyutping, chars := range jpMap {
for _, c := range *chars {
cjp := CJyutPing{}
cjp.Ref = c
cjp.SKey = strings.ToUpper(jyutping)
cjp.Key = &cjp.SKey
searchables = append(searchables, &cjp)
for _, x := range jpMap {
if x.Key == nil {
log.Fatal("getSearchables CJP: ", x)
}
searchables = append(searchables, x)
}
for _, c := range chars {
ccj := CFace{}
ccj.Ref = c
ccj.Key = &c.Face
searchables = append(searchables, &ccj)
for _, x := range chars {
if x.Key == nil {
log.Fatal("getSearchables CChar: ", x)
}
searchables = append(searchables, x)
}
return &searchables, nil