Added kmb and refactored query.Parse

This commit is contained in:
2022-09-17 04:33:47 +08:00
parent 292665c49b
commit 3376d9eb96
21 changed files with 762 additions and 241 deletions

32
datasources/kmb/query.go Normal file
View File

@@ -0,0 +1,32 @@
package kmb
import (
"strings"
query "github.com/tgckpg/golifehk/query"
)
func Query( lang string, message string ) query.IQueryResult {
var qo *query.QueryObject
var err error
qr := QueryResult{ Lang: lang }
busStops, err := getBusStops()
if err != nil {
qr.Error = err
goto qrReturn
}
qo, err = query.Parse( strings.ToUpper( message ), busStops )
if err != nil {
qr.Error = err
goto qrReturn
}
qr.Query = qo
qrReturn:
var iqr query.IQueryResult
iqr = &qr
return iqr
}