mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-11-25 07:16:46 +01:00
25 lines
452 B
Go
25 lines
452 B
Go
|
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
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|