database

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusSchema schema for status updates.
	StatusSchema = "status"
	// LocalStatusSchema schema for local status updates.
	LocalStatusSchema = "local_status"
	// LocalSpecSchema schema for local spec updates.
	LocalSpecSchema = "local_spec"
	// EventSchema schema for policy events
	EventSchema = "event"
)

db schemas.

View Source
const (
	// ManagedClustersTableName table name of managed clusters.
	ManagedClustersTableName = "managed_clusters"

	// ComplianceTableName table name of policy compliance status.
	ComplianceTableName = "compliance"
	// MinimalComplianceTable table name of minimal policy compliance status.
	MinimalComplianceTable = "aggregated_compliance"
	// LocalPolicySpecTableName table name of local policy spec.
	LocalPolicySpecTableName = "policies"

	// SubscriptionStatusesTableName table name of subscription-statuses.
	SubscriptionStatusesTableName = "subscription_statuses"
	// SubscriptionReportsTableName table name of subscription-reports.
	SubscriptionReportsTableName = "subscription_reports"

	// PlacementRulesTableName table name of placement-rules.
	PlacementRulesTableName = "placementrules"
	// PlacementsTableName table name of placements.
	PlacementsTableName = "placements"
	// PlacementDecisionsTableName table name of placement-decisions.
	PlacementDecisionsTableName = "placementdecisions"

	// LeafHubHeartbeatsTableName table name for LH heartbeats.
	LeafHubHeartbeatsTableName = "leaf_hub_heartbeats"

	// HubClusterInfo table name of leaf_hubs.
	HubClusterInfoTableName = "leaf_hubs"

	// PolicyEvent table name of leaf_hubs.
	LocalPolicyEventTableName     = "local_policies"
	LocalRootPolicyEventTableName = "local_root_policies"
)

table names.

View Source
const (
	// UUID unique type.
	UUID = "uuid"
	// Jsonb unique type.
	Jsonb = "jsonb"
	// ComplianceType unique type.
	ComplianceType = "compliance_type"
)

unique db types.

View Source
const (
	// ErrorNone is default value when no error occurs.
	ErrorNone = "none"
)

default values.

View Source
const PostgresDialect = "postgres"

Variables

This section is empty.

Functions

func CloseGorm

func CloseGorm()

Close the sql.DB connection

func GetGorm

func GetGorm() *gorm.DB

func GetPostgresConfig

func GetPostgresConfig(URI string, cert []byte) (*pgx.ConnConfig, error)

func InitGormInstance

func InitGormInstance(config *DatabaseConfig) error

func PostgresConnPool

func PostgresConnPool(ctx context.Context, databaseURI string, certPath string, size int32) (*pgxpool.Pool, error)

PostgresConnPool returns a new postgres connection pool. size < 0 means deafult size.

func PostgresConnection

func PostgresConnection(ctx context.Context, URI string, cert []byte) (*pgx.Conn, error)

Types

type ComplianceStatus

type ComplianceStatus string

ComplianceStatus represents the possible options for compliance status.

const (
	// NonCompliant non compliant state.
	NonCompliant ComplianceStatus = "non_compliant"
	// Compliant compliant state.
	Compliant ComplianceStatus = "compliant"
	// Unknown unknown compliance state.
	Unknown ComplianceStatus = "unknown"
)

compliance states.

type DatabaseConfig

type DatabaseConfig struct {
	URL        string
	Dialect    string
	CaCertPath string
	PoolSize   int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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