golifehk/datasources/kmb/query.go

33 lines
573 B
Go

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
}