-
Notifications
You must be signed in to change notification settings - Fork 4
/
workspace.go
29 lines (24 loc) · 956 Bytes
/
workspace.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package workspace
// This package contains functions and data struct for information
// from the workspace sqlite database
import (
"context"
"errors"
"fmt"
"log"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
)
//
func GetDomainKeysInfo(dbpool *pgxpool.Pool, rdfType string) (*[]string, *string, error) {
objectTypes := make([]string, 0)
var domainKeysJson string
stmt := "SELECT object_types, domain_keys_json FROM jetsapi.domain_keys_registry WHERE entity_rdf_type=$1"
err := dbpool.QueryRow(context.Background(), stmt, rdfType).Scan(&objectTypes, &domainKeysJson)
if err != nil && !errors.Is(err, pgx.ErrNoRows) {
log.Printf("Error in GetDomainKeysInfo while querying domain_keys_registry for rdfType %s: %v", rdfType, err)
return &objectTypes, &domainKeysJson,
fmt.Errorf("in GetDomainKeysInfo while querying domain_keys_registry for rdfType %s: %w", rdfType, err)
}
return &objectTypes, &domainKeysJson, nil
}