tableaccess

package
v10.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tableaccess is the SQLite database.Manager, and every one of its operations refuses.

SQLite has no users, no roles, no grants, and no notion of several databases on one server: a database is a file, and access to it is access to the file. There is nothing for the interface's methods to do, so each reports ErrNotSupported rather than pretending to have provisioned something.

It exists so that dialect selection stays uniform — a service configured against SQLite still resolves a database.Manager — and so the refusal is visible. Every method opens a span and records the error, because a caller finding out at runtime which dialect it was handed should see the refusal in the same trace it would have seen the grant in; a refusal that leaves no trace cannot be told from a call that never happened.

Provisioning a SQLite deployment is a filesystem matter: file permissions and where the file lives, not statements sent to a server.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("operation not supported by SQLite")

ErrNotSupported is returned for operations that SQLite does not support. SQLite has no concept of users, roles, permissions, or multiple databases.

Functions

This section is empty.

Types

type Manager

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

Manager is the SQLite database.Manager implementation: every operation reports ErrNotSupported, because SQLite has no users, roles, or grants. It is exported, and returned by NewManager, so a caller who has chosen SQLite can depend on that choice rather than on the interface every dialect's manager shares.

It is observable anyway, and for the same reason its siblings are: a caller that has been handed a database.Manager and is finding out at runtime which dialect it got should see the refusal in the same trace it would have seen the grant in. A refusal that leaves no trace is indistinguishable from a call that never happened.

func NewManager

func NewManager(opts ...Option) *Manager

func (*Manager) CreateDatabase

func (m *Manager) CreateDatabase(ctx context.Context, _, _ string) error

func (*Manager) CreateUser

func (m *Manager) CreateUser(ctx context.Context, _, _ string) error

func (*Manager) DatabaseExists

func (m *Manager) DatabaseExists(ctx context.Context, _ string) (bool, error)

func (*Manager) DeleteDatabase

func (m *Manager) DeleteDatabase(ctx context.Context, _ string) error

func (*Manager) DeleteUser

func (m *Manager) DeleteUser(ctx context.Context, _ string) error

func (*Manager) GrantUserAccessToTable

func (m *Manager) GrantUserAccessToTable(ctx context.Context, _, _, _, _ string) error

func (*Manager) UserCanAccessDatabase

func (m *Manager) UserCanAccessDatabase(ctx context.Context, _, _ string) (bool, error)

func (*Manager) UserExists

func (m *Manager) UserExists(ctx context.Context, _ string) (bool, error)

type Option

type Option func(*options)

Option configures the Manager this package constructs. The zero configuration works: an absent logger logs nowhere and an absent tracer provider traces nowhere.

There is no metrics provider. Everything here is an administrative act — a role created, a database dropped, a grant issued — performed a handful of times over a deployment's life by something that already reports what it did. A counter over those is a number nobody has a question for; the span and the log line, which say which role and which database, are what somebody auditing the change actually wants.

func WithLogger

func WithLogger(logger logging.Logger) Option

WithLogger attaches a logger.

func WithPillars

func WithPillars(pillars *observability.Pillars) Option

WithPillars supplies logger and tracer provider at once. Options apply in order, so a WithPillars followed by a narrower option wins for that component. The pillars' metrics provider is ignored — see Option.

func WithTracerProvider

func WithTracerProvider(tracerProvider tracing.Provider) Option

WithTracerProvider attaches a tracer provider, enabling spans on every operation.

Jump to

Keyboard shortcuts

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