sqlite

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package sqlite provides a SQLite implementation of the Shield composite store using grove ORM with Go-based migrations.

Index

Constants

This section is empty.

Variables

View Source
var Migrations = migrate.NewGroup("shield")

Migrations is the grove migration group for the Shield store (SQLite).

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements store.Store using SQLite via Grove ORM.

func New

func New(db *grove.DB) *Store

New creates a new SQLite store backed by Grove ORM.

func (*Store) AssignToTenant

func (s *Store) AssignToTenant(ctx context.Context, tenantID string, polID id.PolicyID) error

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) CreateAwareness

func (s *Store) CreateAwareness(ctx context.Context, a *awareness.Awareness) error

func (*Store) CreateBoundary

func (s *Store) CreateBoundary(ctx context.Context, b *boundary.Boundary) error

func (*Store) CreateInstinct

func (s *Store) CreateInstinct(ctx context.Context, inst *instinct.Instinct) error

func (*Store) CreateJudgment

func (s *Store) CreateJudgment(ctx context.Context, j *judgment.Judgment) error

func (*Store) CreatePolicy

func (s *Store) CreatePolicy(ctx context.Context, pol *policy.Policy) error

func (*Store) CreateProfile

func (s *Store) CreateProfile(ctx context.Context, p *profile.SafetyProfile) error

func (*Store) CreateReflex

func (s *Store) CreateReflex(ctx context.Context, r *reflex.Reflex) error

func (*Store) CreateReport

func (s *Store) CreateReport(ctx context.Context, report *compliance.Report) error

func (*Store) CreateScan

func (s *Store) CreateScan(ctx context.Context, result *scan.Result) error

func (*Store) CreateValues

func (s *Store) CreateValues(ctx context.Context, v *values.Values) error

func (*Store) DashboardAssign

func (s *Store) DashboardAssign(ctx context.Context, scope store.Scope, key string, assigned bool) error

DashboardAssign assigns an app-level policy to scope.TenantID. Only an app-scope actor assigns; to a tenant actor policies are read-only.

func (*Store) DashboardAssigned

func (s *Store) DashboardAssigned(ctx context.Context, scope store.Scope, key string) (bool, error)

func (*Store) DashboardCreate

func (s *Store) DashboardCreate(ctx context.Context, scope store.Scope, kind string, raw json.RawMessage) (json.RawMessage, error)

func (*Store) DashboardDelete

func (s *Store) DashboardDelete(ctx context.Context, scope store.Scope, kind, key string) error

func (*Store) DashboardDeleteTokens

func (s *Store) DashboardDeleteTokens(ctx context.Context, scope store.Scope, cutoff time.Time, keys []string) (int64, error)

func (*Store) DashboardGet

func (s *Store) DashboardGet(ctx context.Context, scope store.Scope, kind, key string) (json.RawMessage, error)

func (*Store) DashboardList

func (s *Store) DashboardList(ctx context.Context, scope store.Scope, kind string, f store.Filter) (store.Page, error)

func (*Store) DashboardTokenStats

func (s *Store) DashboardTokenStats(ctx context.Context, scope store.Scope) (store.TokenStats, error)

func (*Store) DashboardTokens

func (s *Store) DashboardTokens(ctx context.Context, scope store.Scope, scanID string, cutoff *time.Time, f store.Filter) (store.Page, error)

func (*Store) DashboardUpdate

func (s *Store) DashboardUpdate(ctx context.Context, scope store.Scope, kind, key string, raw json.RawMessage) (json.RawMessage, error)

func (*Store) DeleteAwareness

func (s *Store) DeleteAwareness(ctx context.Context, aID id.AwarenessID) error

func (*Store) DeleteBoundary

func (s *Store) DeleteBoundary(ctx context.Context, bID id.BoundaryID) error

func (*Store) DeleteInstinct

func (s *Store) DeleteInstinct(ctx context.Context, instID id.InstinctID) error

func (*Store) DeleteJudgment

func (s *Store) DeleteJudgment(ctx context.Context, jID id.JudgmentID) error

func (*Store) DeletePIITokens

func (s *Store) DeletePIITokens(ctx context.Context, tokenIDs []id.PIITokenID) error

func (*Store) DeletePIITokensByTenant

func (s *Store) DeletePIITokensByTenant(ctx context.Context, tenantID string) error

func (*Store) DeletePolicy

func (s *Store) DeletePolicy(ctx context.Context, polID id.PolicyID) error

DeletePolicy is idempotent: a missing policy and one the context cannot see both return nil, and the second is left in place. A visible policy the context may not write (an app-level policy under a tenant) is refused with ErrTenantMismatch rather than skipped.

func (*Store) DeleteProfile

func (s *Store) DeleteProfile(ctx context.Context, pID id.SafetyProfileID) error

func (*Store) DeleteReflex

func (s *Store) DeleteReflex(ctx context.Context, rID id.ReflexID) error

func (*Store) DeleteValues

func (s *Store) DeleteValues(ctx context.Context, vID id.ValueID) error

func (*Store) GetAwareness

func (s *Store) GetAwareness(ctx context.Context, aID id.AwarenessID) (*awareness.Awareness, error)

func (*Store) GetAwarenessByName

func (s *Store) GetAwarenessByName(ctx context.Context, appID, name string) (*awareness.Awareness, error)

func (*Store) GetBoundary

func (s *Store) GetBoundary(ctx context.Context, bID id.BoundaryID) (*boundary.Boundary, error)

func (*Store) GetBoundaryByName

func (s *Store) GetBoundaryByName(ctx context.Context, appID, name string) (*boundary.Boundary, error)

func (*Store) GetInstinct

func (s *Store) GetInstinct(ctx context.Context, instID id.InstinctID) (*instinct.Instinct, error)

func (*Store) GetInstinctByName

func (s *Store) GetInstinctByName(ctx context.Context, appID, name string) (*instinct.Instinct, error)

func (*Store) GetJudgment

func (s *Store) GetJudgment(ctx context.Context, jID id.JudgmentID) (*judgment.Judgment, error)

func (*Store) GetJudgmentByName

func (s *Store) GetJudgmentByName(ctx context.Context, appID, name string) (*judgment.Judgment, error)

func (*Store) GetPoliciesForScope

func (s *Store) GetPoliciesForScope(ctx context.Context, scopeKey string, level policy.ScopeLevel) ([]*policy.Policy, error)

func (*Store) GetPolicy

func (s *Store) GetPolicy(ctx context.Context, polID id.PolicyID) (*policy.Policy, error)

func (*Store) GetPolicyByName

func (s *Store) GetPolicyByName(ctx context.Context, scopeKey, name string) (*policy.Policy, error)

func (*Store) GetProfile

func (s *Store) GetProfile(ctx context.Context, pID id.SafetyProfileID) (*profile.SafetyProfile, error)

func (*Store) GetProfileByName

func (s *Store) GetProfileByName(ctx context.Context, appID, name string) (*profile.SafetyProfile, error)

func (*Store) GetReflex

func (s *Store) GetReflex(ctx context.Context, rID id.ReflexID) (*reflex.Reflex, error)

func (*Store) GetReflexByName

func (s *Store) GetReflexByName(ctx context.Context, appID, name string) (*reflex.Reflex, error)

func (*Store) GetReport

func (s *Store) GetReport(ctx context.Context, reportID id.ComplianceReportID) (*compliance.Report, error)

func (*Store) GetScan

func (s *Store) GetScan(ctx context.Context, scanID id.ScanID) (*scan.Result, error)

func (*Store) GetValues

func (s *Store) GetValues(ctx context.Context, vID id.ValueID) (*values.Values, error)

func (*Store) GetValuesByName

func (s *Store) GetValuesByName(ctx context.Context, appID, name string) (*values.Values, error)

func (*Store) ListAwareness

func (s *Store) ListAwareness(ctx context.Context, filter *awareness.ListFilter) ([]*awareness.Awareness, error)

func (*Store) ListBoundaries

func (s *Store) ListBoundaries(ctx context.Context, filter *boundary.ListFilter) ([]*boundary.Boundary, error)

func (*Store) ListInstincts

func (s *Store) ListInstincts(ctx context.Context, filter *instinct.ListFilter) ([]*instinct.Instinct, error)

func (*Store) ListJudgments

func (s *Store) ListJudgments(ctx context.Context, filter *judgment.ListFilter) ([]*judgment.Judgment, error)

func (*Store) ListPolicies

func (s *Store) ListPolicies(ctx context.Context, filter *policy.ListFilter) ([]*policy.Policy, error)

func (*Store) ListProfiles

func (s *Store) ListProfiles(ctx context.Context, filter *profile.ListFilter) ([]*profile.SafetyProfile, error)

func (*Store) ListReflexes

func (s *Store) ListReflexes(ctx context.Context, filter *reflex.ListFilter) ([]*reflex.Reflex, error)

func (*Store) ListReports

func (s *Store) ListReports(ctx context.Context, filter *compliance.ListFilter) ([]*compliance.Report, error)

func (*Store) ListScans

func (s *Store) ListScans(ctx context.Context, filter *scan.ListFilter) ([]*scan.Result, error)

func (*Store) ListValues

func (s *Store) ListValues(ctx context.Context, filter *values.ListFilter) ([]*values.Values, error)

func (*Store) LoadPIITokens

func (s *Store) LoadPIITokens(ctx context.Context, tokenIDs []id.PIITokenID) ([]*pii.Token, error)

func (*Store) LoadPIITokensByScan

func (s *Store) LoadPIITokensByScan(ctx context.Context, scanID id.ScanID) ([]*pii.Token, error)

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate creates the required tables and indexes using the grove orchestrator.

func (*Store) PIIStats

func (s *Store) PIIStats(ctx context.Context, tenantID string) (*pii.Stats, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping checks database connectivity.

func (*Store) PurgePIITokens

func (s *Store) PurgePIITokens(ctx context.Context, olderThan time.Time) (int64, error)

PurgePIITokens is an operator retention sweep: it removes expired tokens in every tenant and so takes no tenant.

func (*Store) ScanStats

func (s *Store) ScanStats(ctx context.Context, filter *scan.StatsFilter) (*scan.Stats, error)

func (*Store) StorePIITokens

func (s *Store) StorePIITokens(ctx context.Context, tokens []*pii.Token) error

func (*Store) UnassignFromTenant

func (s *Store) UnassignFromTenant(ctx context.Context, tenantID string, polID id.PolicyID) error

func (*Store) UpdateAwareness

func (s *Store) UpdateAwareness(ctx context.Context, a *awareness.Awareness) error

func (*Store) UpdateBoundary

func (s *Store) UpdateBoundary(ctx context.Context, b *boundary.Boundary) error

func (*Store) UpdateInstinct

func (s *Store) UpdateInstinct(ctx context.Context, inst *instinct.Instinct) error

func (*Store) UpdateJudgment

func (s *Store) UpdateJudgment(ctx context.Context, j *judgment.Judgment) error

func (*Store) UpdatePolicy

func (s *Store) UpdatePolicy(ctx context.Context, pol *policy.Policy) error

func (*Store) UpdateProfile

func (s *Store) UpdateProfile(ctx context.Context, p *profile.SafetyProfile) error

func (*Store) UpdateReflex

func (s *Store) UpdateReflex(ctx context.Context, r *reflex.Reflex) error

func (*Store) UpdateValues

func (s *Store) UpdateValues(ctx context.Context, v *values.Values) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL