4
go.mod
4
go.mod
@@ -4,7 +4,9 @@ go 1.23.4
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/99designs/gqlgen v0.17.63
|
github.com/99designs/gqlgen v0.17.63
|
||||||
|
github.com/jackc/pgx/v5 v5.7.1
|
||||||
github.com/prometheus/client_golang v1.20.5
|
github.com/prometheus/client_golang v1.20.5
|
||||||
|
github.com/vektah/gqlparser/v2 v2.5.21
|
||||||
go.gearno.de/kit v0.0.0-20241119134016-ee4f36699e6b
|
go.gearno.de/kit v0.0.0-20241119134016-ee4f36699e6b
|
||||||
go.opentelemetry.io/otel/trace v1.32.0
|
go.opentelemetry.io/otel/trace v1.32.0
|
||||||
)
|
)
|
||||||
@@ -22,7 +24,6 @@ require (
|
|||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect
|
||||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||||
github.com/jackc/pgx/v5 v5.7.1 // indirect
|
|
||||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.17.9 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
@@ -32,7 +33,6 @@ require (
|
|||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/sosodev/duration v1.3.1 // indirect
|
github.com/sosodev/duration v1.3.1 // indirect
|
||||||
github.com/urfave/cli/v2 v2.27.5 // indirect
|
github.com/urfave/cli/v2 v2.27.5 // indirect
|
||||||
github.com/vektah/gqlparser/v2 v2.5.21 // indirect
|
|
||||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
||||||
go.gearno.de/crypto/uuid v0.1.0 // indirect
|
go.gearno.de/crypto/uuid v0.1.0 // indirect
|
||||||
go.gearno.de/x/panicf v0.1.1 // indirect
|
go.gearno.de/x/panicf v0.1.1 // indirect
|
||||||
|
|||||||
13
pkg/probo/coredata/control.go
Normal file
13
pkg/probo/coredata/control.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package coredata
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type (
|
||||||
|
Control struct {
|
||||||
|
ID string
|
||||||
|
FrameworkID string
|
||||||
|
ContentID string
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
||||||
|
)
|
||||||
13
pkg/probo/coredata/evidence.go
Normal file
13
pkg/probo/coredata/evidence.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package coredata
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type (
|
||||||
|
Evidence struct {
|
||||||
|
ID string
|
||||||
|
TaskID string
|
||||||
|
ContentID string
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
||||||
|
)
|
||||||
60
pkg/probo/coredata/framework.go
Normal file
60
pkg/probo/coredata/framework.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package coredata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
"go.gearno.de/kit/pg"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
Framework struct {
|
||||||
|
ID string
|
||||||
|
OrganizationID string
|
||||||
|
ContentID string
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (f *Framework) scan(r pgx.Row) error {
|
||||||
|
return r.Scan(
|
||||||
|
&f.ID,
|
||||||
|
&f.OrganizationID,
|
||||||
|
&f.ContentID,
|
||||||
|
&f.CreatedAt,
|
||||||
|
&f.UpdatedAt,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Framework) LoadByID(
|
||||||
|
ctx context.Context,
|
||||||
|
conn pg.Conn,
|
||||||
|
frameworkID string,
|
||||||
|
) error {
|
||||||
|
q := `
|
||||||
|
SELECT
|
||||||
|
framework_id,
|
||||||
|
organization_id,
|
||||||
|
content_id,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
FROM
|
||||||
|
frameworks
|
||||||
|
WHERE
|
||||||
|
framework_id = @framework_id
|
||||||
|
LIMIT 1;
|
||||||
|
`
|
||||||
|
args := pgx.NamedArgs{"framework_id": frameworkID}
|
||||||
|
r := conn.QueryRow(ctx, q, args)
|
||||||
|
|
||||||
|
f2 := Framework{}
|
||||||
|
if err := r.Scan(&f2); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
*f = f2
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
58
pkg/probo/coredata/organization.go
Normal file
58
pkg/probo/coredata/organization.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package coredata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
"go.gearno.de/kit/pg"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
Organization struct {
|
||||||
|
ID string
|
||||||
|
Name string
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (o *Organization) scan(r pgx.Row) error {
|
||||||
|
return r.Scan(
|
||||||
|
&o.ID,
|
||||||
|
&o.Name,
|
||||||
|
&o.CreatedAt,
|
||||||
|
&o.UpdatedAt,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *Organization) LoadByID(
|
||||||
|
ctx context.Context,
|
||||||
|
conn pg.Conn,
|
||||||
|
organizationID string,
|
||||||
|
) error {
|
||||||
|
q := `
|
||||||
|
SELECT
|
||||||
|
organization_id,
|
||||||
|
name,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
FROM
|
||||||
|
organizations
|
||||||
|
WHERE
|
||||||
|
organization_id = @organization_id
|
||||||
|
LIMIT 1;
|
||||||
|
`
|
||||||
|
|
||||||
|
args := pgx.NamedArgs{"organization_id": organizationID}
|
||||||
|
r := conn.QueryRow(ctx, q, args)
|
||||||
|
|
||||||
|
o2 := Organization{}
|
||||||
|
if err := r.Scan(&o2); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
*o = o2
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
12
pkg/probo/coredata/task.go
Normal file
12
pkg/probo/coredata/task.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package coredata
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type (
|
||||||
|
Task struct {
|
||||||
|
ID string
|
||||||
|
ContentID string
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user