Add processing activity registries

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-27 16:18:18 +02:00
parent bb68af1d3c
commit 199de3bdb0
32 changed files with 9702 additions and 306 deletions

View File

@@ -48,4 +48,5 @@ const (
VendorServiceEntityType
SnapshotEntityType
ContinualImprovementRegistryEntityType
ProcessingActivityRegistryEntityType
)

View File

@@ -0,0 +1,69 @@
CREATE TYPE processing_activity_registries_special_or_criminal_data AS ENUM (
'YES',
'NO',
'POSSIBLE'
);
CREATE TYPE processing_activity_registries_lawful_basis AS ENUM (
'LEGITIMATE_INTEREST',
'CONSENT',
'CONTRACTUAL_NECESSITY',
'LEGAL_OBLIGATION',
'VITAL_INTERESTS',
'PUBLIC_TASK'
);
CREATE TYPE processing_activity_registries_transfer_safeguards AS ENUM (
'STANDARD_CONTRACTUAL_CLAUSES',
'BINDING_CORPORATE_RULES',
'ADEQUACY_DECISION',
'DEROGATIONS',
'CODES_OF_CONDUCT',
'CERTIFICATION_MECHANISMS'
);
CREATE TYPE processing_activity_registries_data_protection_impact_assessment AS ENUM (
'NEEDED',
'NOT_NEEDED'
);
CREATE TYPE processing_activity_registries_transfer_impact_assessment AS ENUM (
'NEEDED',
'NOT_NEEDED'
);
CREATE TABLE processing_activity_registries (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
organization_id TEXT NOT NULL,
audit_id TEXT NOT NULL,
name TEXT NOT NULL,
purpose TEXT,
data_subject_category TEXT,
personal_data_category TEXT,
special_or_criminal_data processing_activity_registries_special_or_criminal_data NOT NULL,
consent_evidence_link TEXT,
lawful_basis processing_activity_registries_lawful_basis NOT NULL,
recipients TEXT,
location TEXT,
international_transfers BOOLEAN NOT NULL,
transfer_safeguards processing_activity_registries_transfer_safeguards,
retention_period TEXT,
security_measures TEXT,
data_protection_impact_assessment processing_activity_registries_data_protection_impact_assessment NOT NULL,
transfer_impact_assessment processing_activity_registries_transfer_impact_assessment NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
CONSTRAINT processing_activity_registries_organization_id_fkey
FOREIGN KEY (organization_id)
REFERENCES organizations(id)
ON UPDATE CASCADE
ON DELETE CASCADE,
CONSTRAINT processing_activity_registries_audit_id_fkey
FOREIGN KEY (audit_id)
REFERENCES audits(id)
ON UPDATE CASCADE
ON DELETE CASCADE
);

View File

@@ -0,0 +1,473 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"context"
"fmt"
"maps"
"time"
"github.com/getprobo/probo/pkg/gid"
"github.com/getprobo/probo/pkg/page"
"github.com/jackc/pgx/v5"
"go.gearno.de/kit/pg"
)
type (
ProcessingActivityRegistry struct {
ID gid.GID `db:"id"`
OrganizationID gid.GID `db:"organization_id"`
AuditID gid.GID `db:"audit_id"`
Name string `db:"name"`
Purpose *string `db:"purpose"`
DataSubjectCategory *string `db:"data_subject_category"`
PersonalDataCategory *string `db:"personal_data_category"`
SpecialOrCriminalData ProcessingActivityRegistrySpecialOrCriminalData `db:"special_or_criminal_data"`
ConsentEvidenceLink *string `db:"consent_evidence_link"`
LawfulBasis ProcessingActivityRegistryLawfulBasis `db:"lawful_basis"`
Recipients *string `db:"recipients"`
Location *string `db:"location"`
InternationalTransfers bool `db:"international_transfers"`
TransferSafeguards *ProcessingActivityRegistryTransferSafeguards `db:"transfer_safeguards"`
RetentionPeriod *string `db:"retention_period"`
SecurityMeasures *string `db:"security_measures"`
DataProtectionImpactAssessment ProcessingActivityRegistryDataProtectionImpactAssessment `db:"data_protection_impact_assessment"`
TransferImpactAssessment ProcessingActivityRegistryTransferImpactAssessment `db:"transfer_impact_assessment"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
ProcessingActivityRegistries []*ProcessingActivityRegistry
)
func (p *ProcessingActivityRegistry) CursorKey(field ProcessingActivityRegistryOrderField) page.CursorKey {
switch field {
case ProcessingActivityRegistryOrderFieldCreatedAt:
return page.NewCursorKey(p.ID, p.CreatedAt)
case ProcessingActivityRegistryOrderFieldName:
return page.NewCursorKey(p.ID, p.Name)
}
panic(fmt.Sprintf("unsupported order by: %s", field))
}
func (p *ProcessingActivityRegistry) LoadByID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
processingActivityRegistryID gid.GID,
) error {
q := `
SELECT
id,
organization_id,
audit_id,
name,
purpose,
data_subject_category,
personal_data_category,
special_or_criminal_data,
consent_evidence_link,
lawful_basis,
recipients,
location,
international_transfers,
transfer_safeguards,
retention_period,
security_measures,
data_protection_impact_assessment,
transfer_impact_assessment,
created_at,
updated_at
FROM
processing_activity_registries
WHERE
%s
AND id = @processing_activity_registry_id
LIMIT 1;
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{"processing_activity_registry_id": processingActivityRegistryID}
maps.Copy(args, scope.SQLArguments())
rows, err := conn.Query(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot query processing activity registry: %w", err)
}
processingActivityRegistry, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[ProcessingActivityRegistry])
if err != nil {
return fmt.Errorf("cannot collect processing activity registry: %w", err)
}
*p = processingActivityRegistry
return nil
}
func (p *ProcessingActivityRegistries) CountByOrganizationID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
organizationID gid.GID,
) (int, error) {
q := `
SELECT
COUNT(id)
FROM
processing_activity_registries
WHERE
%s
AND organization_id = @organization_id
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{"organization_id": organizationID}
maps.Copy(args, scope.SQLArguments())
row := conn.QueryRow(ctx, q, args)
var count int
err := row.Scan(&count)
if err != nil {
return 0, fmt.Errorf("cannot count processing activity registries: %w", err)
}
return count, nil
}
func (p *ProcessingActivityRegistries) LoadByOrganizationID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
organizationID gid.GID,
cursor *page.Cursor[ProcessingActivityRegistryOrderField],
) error {
q := `
SELECT
id,
organization_id,
audit_id,
name,
purpose,
data_subject_category,
personal_data_category,
special_or_criminal_data,
consent_evidence_link,
lawful_basis,
recipients,
location,
international_transfers,
transfer_safeguards,
retention_period,
security_measures,
data_protection_impact_assessment,
transfer_impact_assessment,
created_at,
updated_at
FROM
processing_activity_registries
WHERE
%s
AND organization_id = @organization_id
AND %s
`
q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
args := pgx.StrictNamedArgs{"organization_id": organizationID}
maps.Copy(args, scope.SQLArguments())
maps.Copy(args, cursor.SQLArguments())
rows, err := conn.Query(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot query processing activity registries: %w", err)
}
processingActivityRegistries, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[ProcessingActivityRegistry])
if err != nil {
return fmt.Errorf("cannot collect processing activity registries: %w", err)
}
*p = processingActivityRegistries
return nil
}
func (p *ProcessingActivityRegistries) CountByAuditID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
auditID gid.GID,
) (int, error) {
q := `
SELECT
COUNT(id)
FROM
processing_activity_registries
WHERE
%s
AND audit_id = @audit_id
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{"audit_id": auditID}
maps.Copy(args, scope.SQLArguments())
row := conn.QueryRow(ctx, q, args)
var count int
err := row.Scan(&count)
if err != nil {
return 0, fmt.Errorf("cannot count processing activity registries: %w", err)
}
return count, nil
}
func (p *ProcessingActivityRegistries) LoadByAuditID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
auditID gid.GID,
cursor *page.Cursor[ProcessingActivityRegistryOrderField],
) error {
q := `
SELECT
id,
organization_id,
audit_id,
name,
purpose,
data_subject_category,
personal_data_category,
special_or_criminal_data,
consent_evidence_link,
lawful_basis,
recipients,
location,
international_transfers,
transfer_safeguards,
retention_period,
security_measures,
data_protection_impact_assessment,
transfer_impact_assessment,
created_at,
updated_at
FROM
processing_activity_registries
WHERE
%s
AND audit_id = @audit_id
AND %s
`
q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
args := pgx.StrictNamedArgs{"audit_id": auditID}
maps.Copy(args, scope.SQLArguments())
maps.Copy(args, cursor.SQLArguments())
rows, err := conn.Query(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot query processing activity registries: %w", err)
}
processingActivityRegistries, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[ProcessingActivityRegistry])
if err != nil {
return fmt.Errorf("cannot collect processing activity registries: %w", err)
}
*p = processingActivityRegistries
return nil
}
func (p *ProcessingActivityRegistry) Insert(
ctx context.Context,
conn pg.Conn,
scope Scoper,
) error {
q := `
INSERT INTO processing_activity_registries (
id,
tenant_id,
organization_id,
audit_id,
name,
purpose,
data_subject_category,
personal_data_category,
special_or_criminal_data,
consent_evidence_link,
lawful_basis,
recipients,
location,
international_transfers,
transfer_safeguards,
retention_period,
security_measures,
data_protection_impact_assessment,
transfer_impact_assessment,
created_at,
updated_at
) VALUES (
@id,
@tenant_id,
@organization_id,
@audit_id,
@name,
@purpose,
@data_subject_category,
@personal_data_category,
@special_or_criminal_data,
@consent_evidence_link,
@lawful_basis,
@recipients,
@location,
@international_transfers,
@transfer_safeguards,
@retention_period,
@security_measures,
@data_protection_impact_assessment,
@transfer_impact_assessment,
@created_at,
@updated_at
)
`
args := pgx.StrictNamedArgs{
"id": p.ID,
"tenant_id": scope.GetTenantID(),
"organization_id": p.OrganizationID,
"audit_id": p.AuditID,
"name": p.Name,
"purpose": p.Purpose,
"data_subject_category": p.DataSubjectCategory,
"personal_data_category": p.PersonalDataCategory,
"special_or_criminal_data": p.SpecialOrCriminalData,
"consent_evidence_link": p.ConsentEvidenceLink,
"lawful_basis": p.LawfulBasis,
"recipients": p.Recipients,
"location": p.Location,
"international_transfers": p.InternationalTransfers,
"transfer_safeguards": p.TransferSafeguards,
"retention_period": p.RetentionPeriod,
"security_measures": p.SecurityMeasures,
"data_protection_impact_assessment": p.DataProtectionImpactAssessment,
"transfer_impact_assessment": p.TransferImpactAssessment,
"created_at": p.CreatedAt,
"updated_at": p.UpdatedAt,
}
_, err := conn.Exec(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot insert processing activity registry: %w", err)
}
return nil
}
func (p *ProcessingActivityRegistry) Update(
ctx context.Context,
conn pg.Conn,
scope Scoper,
) error {
q := `
UPDATE processing_activity_registries
SET
name = @name,
purpose = @purpose,
audit_id = @audit_id,
data_subject_category = @data_subject_category,
personal_data_category = @personal_data_category,
special_or_criminal_data = @special_or_criminal_data,
consent_evidence_link = @consent_evidence_link,
lawful_basis = @lawful_basis,
recipients = @recipients,
location = @location,
international_transfers = @international_transfers,
transfer_safeguards = @transfer_safeguards,
retention_period = @retention_period,
security_measures = @security_measures,
data_protection_impact_assessment = @data_protection_impact_assessment,
transfer_impact_assessment = @transfer_impact_assessment,
updated_at = @updated_at
WHERE
%s
AND id = @id
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{
"id": p.ID,
"name": p.Name,
"purpose": p.Purpose,
"audit_id": p.AuditID,
"data_subject_category": p.DataSubjectCategory,
"personal_data_category": p.PersonalDataCategory,
"special_or_criminal_data": p.SpecialOrCriminalData,
"consent_evidence_link": p.ConsentEvidenceLink,
"lawful_basis": p.LawfulBasis,
"recipients": p.Recipients,
"location": p.Location,
"international_transfers": p.InternationalTransfers,
"transfer_safeguards": p.TransferSafeguards,
"retention_period": p.RetentionPeriod,
"security_measures": p.SecurityMeasures,
"data_protection_impact_assessment": p.DataProtectionImpactAssessment,
"transfer_impact_assessment": p.TransferImpactAssessment,
"updated_at": p.UpdatedAt,
}
maps.Copy(args, scope.SQLArguments())
_, err := conn.Exec(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot update processing activity registry: %w", err)
}
return nil
}
func (p *ProcessingActivityRegistry) Delete(
ctx context.Context,
conn pg.Conn,
scope Scoper,
) error {
q := `
DELETE FROM processing_activity_registries
WHERE
%s
AND id = @id
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{"id": p.ID}
maps.Copy(args, scope.SQLArguments())
_, err := conn.Exec(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot delete processing activity registry: %w", err)
}
return nil
}

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type ProcessingActivityRegistryDataProtectionImpactAssessment string
const (
ProcessingActivityRegistryDataProtectionImpactAssessmentNeeded ProcessingActivityRegistryDataProtectionImpactAssessment = "NEEDED"
ProcessingActivityRegistryDataProtectionImpactAssessmentNotNeeded ProcessingActivityRegistryDataProtectionImpactAssessment = "NOT_NEEDED"
)
func (p ProcessingActivityRegistryDataProtectionImpactAssessment) String() string {
return string(p)
}
func (p *ProcessingActivityRegistryDataProtectionImpactAssessment) Scan(value any) error {
var s string
switch v := value.(type) {
case string:
s = v
case []byte:
s = string(v)
default:
return fmt.Errorf("unsupported type for ProcessingActivityRegistryDataProtectionImpactAssessment: %T", value)
}
switch s {
case "NEEDED":
*p = ProcessingActivityRegistryDataProtectionImpactAssessmentNeeded
case "NOT_NEEDED":
*p = ProcessingActivityRegistryDataProtectionImpactAssessmentNotNeeded
default:
return fmt.Errorf("invalid ProcessingActivityRegistryDataProtectionImpactAssessment value: %q", s)
}
return nil
}
func (p ProcessingActivityRegistryDataProtectionImpactAssessment) Value() (driver.Value, error) {
return p.String(), nil
}

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type ProcessingActivityRegistryLawfulBasis string
const (
ProcessingActivityRegistryLawfulBasisLegitimateInterest ProcessingActivityRegistryLawfulBasis = "LEGITIMATE_INTEREST"
ProcessingActivityRegistryLawfulBasisConsent ProcessingActivityRegistryLawfulBasis = "CONSENT"
ProcessingActivityRegistryLawfulBasisContractualNecessity ProcessingActivityRegistryLawfulBasis = "CONTRACTUAL_NECESSITY"
ProcessingActivityRegistryLawfulBasisLegalObligation ProcessingActivityRegistryLawfulBasis = "LEGAL_OBLIGATION"
ProcessingActivityRegistryLawfulBasisVitalInterests ProcessingActivityRegistryLawfulBasis = "VITAL_INTERESTS"
ProcessingActivityRegistryLawfulBasisPublicTask ProcessingActivityRegistryLawfulBasis = "PUBLIC_TASK"
)
func (p ProcessingActivityRegistryLawfulBasis) String() string {
return string(p)
}
func (p *ProcessingActivityRegistryLawfulBasis) Scan(value any) error {
var s string
switch v := value.(type) {
case string:
s = v
case []byte:
s = string(v)
default:
return fmt.Errorf("unsupported type for ProcessingActivityRegistryLawfulBasis: %T", value)
}
switch s {
case "LEGITIMATE_INTEREST":
*p = ProcessingActivityRegistryLawfulBasisLegitimateInterest
case "CONSENT":
*p = ProcessingActivityRegistryLawfulBasisConsent
case "CONTRACTUAL_NECESSITY":
*p = ProcessingActivityRegistryLawfulBasisContractualNecessity
case "LEGAL_OBLIGATION":
*p = ProcessingActivityRegistryLawfulBasisLegalObligation
case "VITAL_INTERESTS":
*p = ProcessingActivityRegistryLawfulBasisVitalInterests
case "PUBLIC_TASK":
*p = ProcessingActivityRegistryLawfulBasisPublicTask
default:
return fmt.Errorf("invalid ProcessingActivityRegistryLawfulBasis value: %q", s)
}
return nil
}
func (p ProcessingActivityRegistryLawfulBasis) Value() (driver.Value, error) {
return p.String(), nil
}

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"fmt"
)
type ProcessingActivityRegistryOrderField string
const (
ProcessingActivityRegistryOrderFieldCreatedAt ProcessingActivityRegistryOrderField = "CREATED_AT"
ProcessingActivityRegistryOrderFieldName ProcessingActivityRegistryOrderField = "NAME"
)
func (p ProcessingActivityRegistryOrderField) Column() string {
return string(p)
}
func (p ProcessingActivityRegistryOrderField) String() string {
return string(p)
}
func (p ProcessingActivityRegistryOrderField) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
func (p *ProcessingActivityRegistryOrderField) UnmarshalText(text []byte) error {
val := string(text)
switch val {
case string(ProcessingActivityRegistryOrderFieldCreatedAt),
string(ProcessingActivityRegistryOrderFieldName):
*p = ProcessingActivityRegistryOrderField(val)
return nil
}
return fmt.Errorf("invalid ProcessingActivityRegistryOrderField value: %q", val)
}

View File

@@ -0,0 +1,60 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type ProcessingActivityRegistrySpecialOrCriminalData string
const (
ProcessingActivityRegistrySpecialOrCriminalDataYes ProcessingActivityRegistrySpecialOrCriminalData = "YES"
ProcessingActivityRegistrySpecialOrCriminalDataNo ProcessingActivityRegistrySpecialOrCriminalData = "NO"
ProcessingActivityRegistrySpecialOrCriminalDataPossible ProcessingActivityRegistrySpecialOrCriminalData = "POSSIBLE"
)
func (p ProcessingActivityRegistrySpecialOrCriminalData) String() string {
return string(p)
}
func (p *ProcessingActivityRegistrySpecialOrCriminalData) Scan(value any) error {
var s string
switch v := value.(type) {
case string:
s = v
case []byte:
s = string(v)
default:
return fmt.Errorf("unsupported type for ProcessingActivityRegistrySpecialOrCriminalData: %T", value)
}
switch s {
case "YES":
*p = ProcessingActivityRegistrySpecialOrCriminalDataYes
case "NO":
*p = ProcessingActivityRegistrySpecialOrCriminalDataNo
case "POSSIBLE":
*p = ProcessingActivityRegistrySpecialOrCriminalDataPossible
default:
return fmt.Errorf("invalid ProcessingActivityRegistrySpecialOrCriminalData value: %q", s)
}
return nil
}
func (p ProcessingActivityRegistrySpecialOrCriminalData) Value() (driver.Value, error) {
return p.String(), nil
}

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type ProcessingActivityRegistryTransferImpactAssessment string
const (
ProcessingActivityRegistryTransferImpactAssessmentNeeded ProcessingActivityRegistryTransferImpactAssessment = "NEEDED"
ProcessingActivityRegistryTransferImpactAssessmentNotNeeded ProcessingActivityRegistryTransferImpactAssessment = "NOT_NEEDED"
)
func (p ProcessingActivityRegistryTransferImpactAssessment) String() string {
return string(p)
}
func (p *ProcessingActivityRegistryTransferImpactAssessment) Scan(value any) error {
var s string
switch v := value.(type) {
case string:
s = v
case []byte:
s = string(v)
default:
return fmt.Errorf("unsupported type for ProcessingActivityRegistryTransferImpactAssessment: %T", value)
}
switch s {
case "NEEDED":
*p = ProcessingActivityRegistryTransferImpactAssessmentNeeded
case "NOT_NEEDED":
*p = ProcessingActivityRegistryTransferImpactAssessmentNotNeeded
default:
return fmt.Errorf("invalid ProcessingActivityRegistryTransferImpactAssessment value: %q", s)
}
return nil
}
func (p ProcessingActivityRegistryTransferImpactAssessment) Value() (driver.Value, error) {
return p.String(), nil
}

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
import (
"database/sql/driver"
"fmt"
)
type ProcessingActivityRegistryTransferSafeguards string
const (
ProcessingActivityRegistryTransferSafeguardsStandardContractualClauses ProcessingActivityRegistryTransferSafeguards = "STANDARD_CONTRACTUAL_CLAUSES"
ProcessingActivityRegistryTransferSafeguardsBindingCorporateRules ProcessingActivityRegistryTransferSafeguards = "BINDING_CORPORATE_RULES"
ProcessingActivityRegistryTransferSafeguardsAdequacyDecision ProcessingActivityRegistryTransferSafeguards = "ADEQUACY_DECISION"
ProcessingActivityRegistryTransferSafeguardsDerogations ProcessingActivityRegistryTransferSafeguards = "DEROGATIONS"
ProcessingActivityRegistryTransferSafeguardsCodesOfConduct ProcessingActivityRegistryTransferSafeguards = "CODES_OF_CONDUCT"
ProcessingActivityRegistryTransferSafeguardsCertificationMechanisms ProcessingActivityRegistryTransferSafeguards = "CERTIFICATION_MECHANISMS"
)
func (p ProcessingActivityRegistryTransferSafeguards) String() string {
return string(p)
}
func (p *ProcessingActivityRegistryTransferSafeguards) Scan(value any) error {
var s string
switch v := value.(type) {
case string:
s = v
case []byte:
s = string(v)
default:
return fmt.Errorf("unsupported type for ProcessingActivityRegistryTransferSafeguards: %T", value)
}
switch s {
case "STANDARD_CONTRACTUAL_CLAUSES":
*p = ProcessingActivityRegistryTransferSafeguardsStandardContractualClauses
case "BINDING_CORPORATE_RULES":
*p = ProcessingActivityRegistryTransferSafeguardsBindingCorporateRules
case "ADEQUACY_DECISION":
*p = ProcessingActivityRegistryTransferSafeguardsAdequacyDecision
case "DEROGATIONS":
*p = ProcessingActivityRegistryTransferSafeguardsDerogations
case "CODES_OF_CONDUCT":
*p = ProcessingActivityRegistryTransferSafeguardsCodesOfConduct
case "CERTIFICATION_MECHANISMS":
*p = ProcessingActivityRegistryTransferSafeguardsCertificationMechanisms
default:
return fmt.Errorf("invalid ProcessingActivityRegistryTransferSafeguards value: %q", s)
}
return nil
}
func (p ProcessingActivityRegistryTransferSafeguards) Value() (driver.Value, error) {
return p.String(), nil
}