-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan.go
62 lines (57 loc) · 2.33 KB
/
scan.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package db
import "github.com/mehix/sec-checklist/pkg/domain"
// Scanner used as constraint for `scanForControl`
type Scanner interface {
Scan(...any) error
}
func scanForControl[T Scanner](s T) (domain.Control, error) {
var id, tp, name, desc, assetType, lastUpdate, oldID, c, i, a, t, handledCentrallyBy string
var pd, nsi, sese, otcl, csr, spsa, spsaUnique, operationalCapability string
var gdpr, gdprUnique, externalSupplier, partOfGisr bool
var onlyHandleCentrally, excludedForExternalSupplier, softwareDevelopmentRelevant bool
var cloudOnly, physicalSecurityOnly, personalSecurityOnly bool
finalValues := []any{
&id, &tp, &name, &desc,
&assetType, &lastUpdate, &oldID,
&c, &i, &a, &t,
&pd, &nsi, &sese, &otcl, &csr, &spsa, &spsaUnique,
&gdpr, &gdprUnique, &externalSupplier, &operationalCapability, &partOfGisr,
&onlyHandleCentrally, &handledCentrallyBy, &excludedForExternalSupplier,
&softwareDevelopmentRelevant, &cloudOnly,
&physicalSecurityOnly, &personalSecurityOnly}
if err := s.Scan(finalValues...); err != nil {
return domain.Control{}, err
}
return domain.Control{
ID: id,
Type: tp,
Name: name,
Description: desc,
AssetType: assetType,
LastUpdated: lastUpdate,
OldID: oldID,
C: c,
I: i,
A: a,
T: t,
PD: pd,
NSI: nsi,
SESE: sese,
OTCL: otcl,
CSRDirection: csr,
SPSA: spsa,
SPSAUnique: spsaUnique,
GDPR: gdpr,
GDPRUnique: gdprUnique,
ExternalSupplier: externalSupplier,
OperationalCapability: operationalCapability,
PartOfGISR: partOfGisr,
OnlyHandledCentrally: onlyHandleCentrally,
HandledCentrallyBy: handledCentrallyBy,
ExcludeForExternalSupplier: excludedForExternalSupplier,
SoftwareDevelopmentRelevant: softwareDevelopmentRelevant,
CloudOnly: cloudOnly,
PhysicalSecurityOnly: physicalSecurityOnly,
PersonalSecurityOnly: personalSecurityOnly,
}, nil
}