db

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package db provides database implementations of the access control interfaces

Package db provides stub implementations for testing

Package db provides database implementations of the access control interfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSQLAuditStore

func NewSQLAuditStore(db *sql.DB) (adapter.ModelsAuditStore, error)

NewSQLAuditStore creates a stub audit store for compilation

func NewSQLIncidentStore

func NewSQLIncidentStore(db *sql.DB) (adapter.IncidentStore, error)

NewSQLIncidentStore creates a stub incident store for compilation

func NewSQLSessionStore

func NewSQLSessionStore(db *sql.DB) (adapter.SessionStore, error)

NewSQLSessionStore creates a stub session store for compilation

func NewSQLUserStore

func NewSQLUserStore(db *sql.DB) (interfaces.UserStore, error)

NewSQLUserStore creates a stub user store for compilation

func NewSQLVulnerabilityStore

func NewSQLVulnerabilityStore(db *sql.DB) (interfaces.VulnerabilityStore, error)

NewSQLVulnerabilityStore creates a stub vulnerability store for compilation

Types

type DBConfig

type DBConfig struct {
	// Driver is the database driver to use (e.g., "sqlite3", "postgres")
	Driver string

	// DSN is the data source name for the database connection
	DSN string

	// MaxOpenConns is the maximum number of open connections to the database
	MaxOpenConns int

	// MaxIdleConns is the maximum number of idle connections in the connection pool
	MaxIdleConns int
}

DBConfig contains configuration for database connections

func DefaultSQLiteConfig

func DefaultSQLiteConfig(dbPath string) *DBConfig

DefaultSQLiteConfig returns a default SQLite configuration

type Factory

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

Factory is a factory for creating database-backed access control components

func NewFactory

func NewFactory(config *DBConfig) (*Factory, error)

NewFactory creates a new database factory

func (*Factory) Close

func (f *Factory) Close() error

Close closes the database connection

func (*Factory) CreateAllStores

func (f *Factory) CreateAllStores() error

CreateAllStores creates all stores and returns any errors

func (*Factory) CreateAuditStore

func (f *Factory) CreateAuditStore() (interfaces.AuditLogger, error)

CreateAuditStore creates a new SQL-based audit store

func (*Factory) CreateIncidentStore

func (f *Factory) CreateIncidentStore() (interfaces.IncidentStore, error)

CreateIncidentStore creates a new SQL-based incident store

func (*Factory) CreateSessionStore

func (f *Factory) CreateSessionStore() (interfaces.SessionStore, error)

CreateSessionStore creates a new SQL-based session store

func (*Factory) CreateUserStore

func (f *Factory) CreateUserStore() (interfaces.UserStore, error)

CreateUserStore creates a new SQL-based user store

func (*Factory) CreateVulnerabilityStore

func (f *Factory) CreateVulnerabilityStore() (interfaces.VulnerabilityStore, error)

CreateVulnerabilityStore creates a new SQL-based vulnerability store

func (*Factory) GetAuditStore added in v0.8.0

func (f *Factory) GetAuditStore() (interfaces.AuditLogger, error)

GetAuditStore returns an audit store implementation

func (*Factory) GetIncidentStore added in v0.8.0

func (f *Factory) GetIncidentStore() (interfaces.IncidentStore, error)

GetIncidentStore returns an incident store implementation

func (*Factory) GetSessionStore added in v0.8.0

func (f *Factory) GetSessionStore() (interfaces.SessionStore, error)

GetSessionStore returns a session store implementation

func (*Factory) GetUserStore added in v0.8.0

func (f *Factory) GetUserStore() (interfaces.UserStore, error)

GetUserStore returns a user store implementation

func (*Factory) GetVulnerabilityStore added in v0.8.0

func (f *Factory) GetVulnerabilityStore() (interfaces.VulnerabilityStore, error)

GetVulnerabilityStore returns a vulnerability store implementation

Directories

Path Synopsis
Package adapter provides adapters for the access control system
Package adapter provides adapters for the access control system

Jump to

Keyboard shortcuts

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