2023-02-03 10:29:27 +01:00
|
|
|
package queries
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/knadh/goyesql/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Queries struct {
|
|
|
|
// Keystore
|
|
|
|
WriteKeyPair string `query:"write-key-pair"`
|
|
|
|
LoadKeyPair string `query:"load-key-pair"`
|
|
|
|
// OTX
|
2023-02-09 08:42:15 +01:00
|
|
|
CreateOTX string `query:"create-otx"`
|
|
|
|
// Dispatch
|
|
|
|
CreateDispatchStatus string `query:"create-dispatch-status"`
|
2023-02-03 10:29:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func LoadQueries(q goyesql.Queries) (*Queries, error) {
|
|
|
|
loadedQueries := &Queries{}
|
|
|
|
|
|
|
|
if err := goyesql.ScanToStruct(loadedQueries, q, nil); err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to scan queries %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return loadedQueries, nil
|
|
|
|
}
|