postgres

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalystScopedColumns

func AnalystScopedColumns(allowlist []string) bool

func ApplyScopedReaderGrants

func ApplyScopedReaderGrants(ctx context.Context, databaseURL string, params ScopedReaderGrantSQLParams) (string, error)

func BuildScopedReaderGrantSQL

func BuildScopedReaderGrantSQL(params ScopedReaderGrantSQLParams) (string, error)

func BusinessPilotScopedColumns

func BusinessPilotScopedColumns(allowlist []string) bool

func DefaultReadOnlyFunctionSignatures

func DefaultReadOnlyFunctionSignatures() []string

func FunctionSignaturesForTools

func FunctionSignaturesForTools(allowlist []string) []string

func GovernanceFunctionSignatures

func GovernanceFunctionSignatures() []string

func URLFromEnv

func URLFromEnv(getenv func(string) string) string

Types

type CacheDiagnostics

type CacheDiagnostics struct {
	Backend                string `json:"backend"`
	SchemaVersion          int    `json:"schema_version"`
	SupportedSchemaVersion int    `json:"supported_schema_version"`
	ReadModelReady         bool   `json:"read_model_ready"`
	ReadModelStatus        string `json:"read_model_status"`
	ReadModelStaleReason   string `json:"read_model_stale_reason,omitempty"`
	ProfileCacheStatus     string `json:"profile_cache_status"`
	ReaderPrivilegeStatus  string `json:"reader_privilege_status"`
}

type ColumnSelectGrant

type ColumnSelectGrant struct {
	Table  string
	Column string
}

func BusinessPilotColumnSelectGrants

func BusinessPilotColumnSelectGrants() []ColumnSelectGrant

func DefaultReadOnlyColumnSelectGrants

func DefaultReadOnlyColumnSelectGrants() []ColumnSelectGrant

func ScopedReaderColumnSelectGrants

func ScopedReaderColumnSelectGrants() []ColumnSelectGrant

type GovernancePolicyState

type GovernancePolicyState struct {
	ConfigSHA256        string   `json:"config_sha256"`
	DataFingerprint     string   `json:"data_fingerprint"`
	ConfigEntries       int      `json:"config_entries"`
	ConfigAliases       int      `json:"config_aliases"`
	MatchedEntries      int      `json:"matched_entries"`
	UnmatchedEntries    int      `json:"unmatched_entries"`
	SuppressedCallCount int      `json:"suppressed_call_count"`
	SuppressedCallIDs   []string `json:"suppressed_call_ids,omitempty"`
	UpdatedAt           string   `json:"updated_at"`
}

type ReadModelStatus

type ReadModelStatus struct {
	ModelName              string `json:"model_name"`
	ModelVersion           int    `json:"model_version"`
	CurrentVersion         int    `json:"current_version"`
	Ready                  bool   `json:"ready"`
	RebuiltAt              string `json:"rebuilt_at"`
	CallCount              int64  `json:"call_count"`
	FactCount              int64  `json:"fact_count"`
	MissingFactCallCount   int64  `json:"missing_fact_call_count"`
	OrphanFactCount        int64  `json:"orphan_fact_count"`
	StaleReason            string `json:"stale_reason,omitempty"`
	DiagnosticsCallCount   int64  `json:"diagnostics_call_count"`
	LimitExceededCallCount int64  `json:"limit_exceeded_call_count"`
	UpdatedAt              string `json:"updated_at"`
}

type ReadOnlyOptions

type ReadOnlyOptions struct {
	RequiredFunctionSignatures     []string
	AllowedFunctionSignatures      []string
	EnforceAllowedFunctionBoundary bool
	RequiredColumnSelectGrants     []ColumnSelectGrant
	AllowedColumnSelectGrants      []ColumnSelectGrant
	EnforceAllowedColumnBoundary   bool
}

func ReadOnlyOptionsForToolAllowlist

func ReadOnlyOptionsForToolAllowlist(allowlist []string) ReadOnlyOptions

type ScopedReaderGrantSQLParams

type ScopedReaderGrantSQLParams struct {
	Allowlist    []string
	RoleName     string
	DatabaseName string
	Generator    string
}

type Store

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

func Open

func Open(ctx context.Context, databaseURL string) (*Store, error)

func OpenProfileInventory

func OpenProfileInventory(ctx context.Context, databaseURL string) (*Store, error)

func OpenReadOnly

func OpenReadOnly(ctx context.Context, databaseURL string) (*Store, error)

func OpenReadOnlyWithOptions

func OpenReadOnlyWithOptions(ctx context.Context, databaseURL string, options ReadOnlyOptions) (*Store, error)

func OpenStatus

func OpenStatus(ctx context.Context, databaseURL string) (*Store, error)

func (*Store) ActivateProfile

func (s *Store) ActivateProfile(ctx context.Context, ref string) (*sqlite.ProfileImportResult, error)

func (*Store) ActiveBusinessProfile

func (s *Store) ActiveBusinessProfile(ctx context.Context) (*sqlite.BusinessProfile, error)

func (*Store) ActiveProfileDocument

func (s *Store) ActiveProfileDocument(ctx context.Context) (*profilepkg.Profile, error)

func (*Store) AnalyzeLateStageSignals

func (s *Store) AnalyzeLateStageSignals(ctx context.Context, params sqlite.LateStageSignalParams) (*sqlite.LateStageSignalsReport, error)

func (*Store) BuildAndSaveGovernancePolicy

func (s *Store) BuildAndSaveGovernancePolicy(ctx context.Context, configSHA256 string, cfg *governance.Config) (*governance.Audit, *GovernancePolicyState, error)

func (*Store) CacheDiagnostics

func (s *Store) CacheDiagnostics(ctx context.Context) (*CacheDiagnostics, error)

func (*Store) CacheInventory

func (s *Store) CacheInventory(ctx context.Context) (*sqlite.CacheInventory, error)

func (*Store) CallFactsCoverage

func (s *Store) CallFactsCoverage(ctx context.Context) (*sqlite.CallFactsCoverage, error)

func (*Store) CallFactsCoverageWithSource

func (s *Store) CallFactsCoverageWithSource(ctx context.Context, sourceArg string) (*sqlite.CallFactsCoverage, []sqlite.CallFactsSummaryRow, *sqlite.ProfileQueryInfo, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) DB

func (s *Store) DB() *sql.DB

func (*Store) FindCallsMissingTranscripts

func (s *Store) FindCallsMissingTranscripts(ctx context.Context, limit int) ([]sqlite.MissingTranscriptCall, error)

func (*Store) FindCallsMissingTranscriptsByFilters

func (s *Store) FindCallsMissingTranscriptsByFilters(ctx context.Context, params sqlite.MissingTranscriptSearchParams) ([]sqlite.MissingTranscriptCall, error)

func (*Store) FinishSyncRun

func (s *Store) FinishSyncRun(ctx context.Context, runID int64, params sqlite.FinishSyncRunParams) error

func (*Store) GetCallDetail

func (s *Store) GetCallDetail(ctx context.Context, callID string) (*sqlite.CallDetail, error)

func (*Store) GetScorecardDetail

func (s *Store) GetScorecardDetail(ctx context.Context, scorecardID string) (*sqlite.ScorecardDetail, error)

func (*Store) GovernanceDataFingerprint

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

func (*Store) GovernanceNameCandidates

func (s *Store) GovernanceNameCandidates(ctx context.Context) ([]governance.Candidate, error)

func (*Store) ImportProfile

func (s *Store) ImportProfile(ctx context.Context, params sqlite.ProfileImportParams) (*sqlite.ProfileImportResult, error)

func (*Store) ListBusinessConcepts

func (s *Store) ListBusinessConcepts(ctx context.Context) ([]sqlite.BusinessConcept, error)

func (*Store) ListCRMFields

func (s *Store) ListCRMFields(ctx context.Context, objectType string, limit int) ([]sqlite.CRMFieldSummary, error)

func (*Store) ListCRMIntegrations

func (s *Store) ListCRMIntegrations(ctx context.Context) ([]sqlite.CRMIntegrationRecord, error)

func (*Store) ListCRMObjectTypes

func (s *Store) ListCRMObjectTypes(ctx context.Context) ([]sqlite.CRMObjectTypeSummary, error)

func (*Store) ListCRMSchemaFields

func (s *Store) ListCRMSchemaFields(ctx context.Context, params sqlite.CRMSchemaFieldListParams) ([]sqlite.CRMSchemaFieldRecord, error)

func (*Store) ListCRMSchemaObjects

func (s *Store) ListCRMSchemaObjects(ctx context.Context, integrationID string) ([]sqlite.CRMSchemaObjectRecord, error)

func (*Store) ListGongSettings

func (s *Store) ListGongSettings(ctx context.Context, params sqlite.GongSettingListParams) ([]sqlite.GongSettingRecord, error)

func (*Store) ListLifecycleBucketDefinitions

func (s *Store) ListLifecycleBucketDefinitions(ctx context.Context) ([]sqlite.LifecycleBucketDefinition, error)

func (*Store) ListLifecycleBucketDefinitionsWithSource

func (s *Store) ListLifecycleBucketDefinitionsWithSource(ctx context.Context, requested string) ([]sqlite.LifecycleBucketDefinition, *sqlite.ProfileQueryInfo, error)

func (*Store) ListProfiles

func (s *Store) ListProfiles(ctx context.Context) ([]sqlite.ProfileHistoryEntry, error)

func (*Store) ListScorecards

func (s *Store) ListScorecards(ctx context.Context, params sqlite.ScorecardListParams) ([]sqlite.ScorecardSummary, error)

func (*Store) ListUnmappedCRMFields

func (s *Store) ListUnmappedCRMFields(ctx context.Context, params sqlite.UnmappedCRMFieldParams) ([]sqlite.UnmappedCRMField, error)

func (*Store) LoadGovernancePolicy

func (s *Store) LoadGovernancePolicy(ctx context.Context, configSHA256 string) (*GovernancePolicyState, error)

func (*Store) Migrate

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

func (*Store) PlanCachePurgeBefore

func (s *Store) PlanCachePurgeBefore(ctx context.Context, startedBefore string) (*sqlite.CachePurgePlan, error)

func (*Store) ProfileDocument

func (s *Store) ProfileDocument(ctx context.Context, ref string) (*sqlite.StoredProfileDocument, error)

func (*Store) ProfileInventory

func (s *Store) ProfileInventory(ctx context.Context) (*profilepkg.Inventory, error)

func (*Store) PurgeCacheBefore

func (s *Store) PurgeCacheBefore(ctx context.Context, startedBefore string) (*sqlite.CachePurgePlan, error)

func (*Store) ReadModelStatus

func (s *Store) ReadModelStatus(ctx context.Context) (*ReadModelStatus, error)

func (*Store) RebuildReadModel

func (s *Store) RebuildReadModel(ctx context.Context) (*ReadModelStatus, error)

func (*Store) RefreshActiveProfileReadModel

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

func (*Store) ResolveLifecycleSource

func (s *Store) ResolveLifecycleSource(ctx context.Context, requested string) (string, *sqlite.BusinessProfile, error)

func (*Store) ScorecardActivityOverview

func (s *Store) ScorecardActivityOverview(ctx context.Context, limit int) (*sqlite.ScorecardActivityOverview, error)

func (*Store) SearchCRMFieldValues

func (s *Store) SearchCRMFieldValues(ctx context.Context, params sqlite.CRMFieldValueSearchParams) ([]sqlite.CRMFieldValueMatch, error)

func (*Store) SearchCallsByLifecycle

func (s *Store) SearchCallsByLifecycle(ctx context.Context, params sqlite.LifecycleCallSearchParams) ([]sqlite.LifecycleCallSearchResult, error)

func (*Store) SearchCallsRaw

func (s *Store) SearchCallsRaw(ctx context.Context, params sqlite.CallSearchParams) ([]json.RawMessage, error)

func (*Store) SearchTranscriptSegments

func (s *Store) SearchTranscriptSegments(ctx context.Context, query string, limit int) ([]sqlite.TranscriptSearchResult, error)

func (*Store) SearchTranscriptSegmentsByCRMContext

func (s *Store) SearchTranscriptSegmentsByCRMContext(ctx context.Context, params sqlite.TranscriptCRMSearchParams) ([]sqlite.TranscriptCRMSearchResult, error)

func (*Store) StartSyncRun

func (s *Store) StartSyncRun(ctx context.Context, params sqlite.StartSyncRunParams) (*sqlite.SyncRun, error)

func (*Store) SummarizeCallFacts

func (s *Store) SummarizeCallFacts(ctx context.Context, params sqlite.CallFactsSummaryParams) ([]sqlite.CallFactsSummaryRow, error)

func (*Store) SummarizeCallFactsWithSource

func (s *Store) SummarizeCallFactsWithSource(ctx context.Context, params sqlite.CallFactsSummaryParams) ([]sqlite.CallFactsSummaryRow, *sqlite.ProfileQueryInfo, error)

func (*Store) SummarizeCallsByLifecycle

func (s *Store) SummarizeCallsByLifecycle(ctx context.Context, params sqlite.LifecycleSummaryParams) ([]sqlite.LifecycleBucketSummary, error)

func (*Store) SummarizeCallsByLifecycleWithSource

func (s *Store) SummarizeCallsByLifecycleWithSource(ctx context.Context, params sqlite.LifecycleSummaryParams) ([]sqlite.LifecycleBucketSummary, *sqlite.ProfileQueryInfo, error)

func (*Store) SummarizeOpportunityCalls

func (s *Store) SummarizeOpportunityCalls(ctx context.Context, params sqlite.OpportunityCallSummaryParams) ([]sqlite.OpportunityCallSummary, error)

func (*Store) SyncStatusSummary

func (s *Store) SyncStatusSummary(ctx context.Context) (*sqlite.SyncStatusSummary, error)

func (*Store) UpsertCRMIntegration

func (s *Store) UpsertCRMIntegration(ctx context.Context, raw json.RawMessage) (*sqlite.CRMIntegrationRecord, error)

func (*Store) UpsertCRMSchema

func (s *Store) UpsertCRMSchema(ctx context.Context, integrationID string, objectType string, raw json.RawMessage) (int64, error)

func (*Store) UpsertCall

func (s *Store) UpsertCall(ctx context.Context, raw json.RawMessage) (*sqlite.CallRecord, error)

func (*Store) UpsertGongSetting

func (s *Store) UpsertGongSetting(ctx context.Context, kind string, raw json.RawMessage) (*sqlite.GongSettingRecord, error)

func (*Store) UpsertScorecardActivity

func (s *Store) UpsertScorecardActivity(ctx context.Context, raw json.RawMessage) (*sqlite.ScorecardActivityRecord, error)

func (*Store) UpsertTranscript

func (s *Store) UpsertTranscript(ctx context.Context, raw json.RawMessage) (*sqlite.TranscriptRecord, error)

func (*Store) UpsertUser

func (s *Store) UpsertUser(ctx context.Context, raw json.RawMessage) (*sqlite.UserRecord, error)

Jump to

Keyboard shortcuts

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