Documentation
¶
Overview ¶
Package sqlitefile secures file-backed SQLite databases before a driver opens them. It deliberately leaves caller-owned parent directory modes alone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Location ¶
type Location struct {
Path string
FileBacked bool
Memory bool
// contains filtered or unexported fields
}
Location is the single canonical interpretation of a SQLite DSN used by filesystem permission and ownership-lock boundaries.
func PreparePrivate ¶
PreparePrivate creates a file-backed SQLite database with mode 0600, or tightens an existing regular database to that mode. In-memory DSNs need no filesystem preparation. Parent directories must already exist; their modes are never changed.
The returned Location is the only value callers should use for sql.Open and related owner locks. This keeps the permission check, lock, and actual driver open on one canonical absolute path.
func Resolve ¶
Resolve maps a SQLite DSN to one canonical filesystem path. The same result must be used by every permission and single-owner boundary so encoded URI, relative-path, and symlinked-parent aliases cannot acquire separate locks.
func (Location) OpenDSN ¶
OpenDSN returns the canonical DSN that must be passed to sql.Open. For a file-backed database it names Location.Path with an absolute path while retaining the original URI query byte-for-byte. In-memory DSNs are returned unchanged so named and shared-cache memory semantics are preserved.