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 ¶
- Variables
- type Manager
- func (m *Manager) CreateDatabase(ctx context.Context, _, _ string) error
- func (m *Manager) CreateUser(ctx context.Context, _, _ string) error
- func (m *Manager) DatabaseExists(ctx context.Context, _ string) (bool, error)
- func (m *Manager) DeleteDatabase(ctx context.Context, _ string) error
- func (m *Manager) DeleteUser(ctx context.Context, _ string) error
- func (m *Manager) GrantUserAccessToTable(ctx context.Context, _, _, _, _ string) error
- func (m *Manager) UserCanAccessDatabase(ctx context.Context, _, _ string) (bool, error)
- func (m *Manager) UserExists(ctx context.Context, _ string) (bool, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
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 (*Manager) CreateDatabase ¶
func (*Manager) DatabaseExists ¶
func (*Manager) DeleteDatabase ¶
func (*Manager) GrantUserAccessToTable ¶
func (*Manager) UserCanAccessDatabase ¶
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 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 ¶
WithTracerProvider attaches a tracer provider, enabling spans on every operation.