2023-02-15 08:05:43 +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"`
|
2023-02-21 18:34:22 +01:00
|
|
|
// Store
|
|
|
|
CreateOTX string `query:"create-otx"`
|
|
|
|
CreateDispatchStatus string `query:"create-dispatch-status"`
|
|
|
|
UpdateChainStatus string `query:"update-chain-status"`
|
|
|
|
GetTxStatusByTrackingId string `query:"get-tx-status-by-tracking-id"`
|
2023-02-15 08:05:43 +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
|
|
|
|
}
|