Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GenericError = sqliteError{1, "Generic Error"} InternalError = sqliteError{2, "Internal Error"} PermError = sqliteError{3, "Perm Error"} AbortError = sqliteError{4, "Abort Error"} BusyError = sqliteError{5, "Busy Error"} LockedError = sqliteError{6, "Locked Error"} NoMemError = sqliteError{7, "No Mem Error"} ReadOnlyError = sqliteError{8, "Read Only Error"} InterruptError = sqliteError{9, "Interrupt Error"} IOError = sqliteError{10, "IO Error"} CorruptError = sqliteError{11, "Corrupt Error"} NotFoundError = sqliteError{12, "Not Found Error"} FullError = sqliteError{13, "Full Error"} CantOpenError = sqliteError{14, "CantOpen Error"} ProtocolError = sqliteError{15, "Protocol Error"} EmptyError = sqliteError{16, "Empty Error"} SchemaError = sqliteError{17, "Schema Error"} TooBigError = sqliteError{18, "TooBig Error"} ConstraintError = sqliteError{19, "Constraint Error"} MismatchError = sqliteError{20, "Mismatch Error"} MisuseError = sqliteError{21, "Misuse Error"} NoLFSError = sqliteError{22, "No Large File Support Error"} AuthError = sqliteError{23, "Auth Error"} FormatError = sqliteError{24, "Format Error"} RangeError = sqliteError{25, "Range Error"} NotaDBError = sqliteError{26, "Not a DB Error"} NoticeError = sqliteError{27, "Notice Error"} WarningError = sqliteError{28, "Warning Error"} IOErrorRead = sqliteError{266, "IO Error Read"} IOErrorShortRead = sqliteError{522, "IO Error Short Read"} IOErrorWrite = sqliteError{778, "IO Error Write"} )
Functions ¶
Types ¶
type AccessFlag ¶
type AccessFlag int
const ( AccessExists AccessFlag = 0 // Does the file exist? AccessReadWrite AccessFlag = 1 // Is the file both readable and writeable? AccessRead AccessFlag = 2 // Is the file readable? )
type DeviceCharacteristic ¶
type DeviceCharacteristic int
https://www.sqlite.org/c3ref/c_iocap_atomic.html
const ( IocapAtomic DeviceCharacteristic = 0x00000001 IocapAtomic512 DeviceCharacteristic = 0x00000002 IocapAtomic1K DeviceCharacteristic = 0x00000004 IocapAtomic2K DeviceCharacteristic = 0x00000008 IocapAtomic4K DeviceCharacteristic = 0x00000010 IocapAtomic8K DeviceCharacteristic = 0x00000020 IocapAtomic16K DeviceCharacteristic = 0x00000040 IocapAtomic32K DeviceCharacteristic = 0x00000080 IocapAtomic64K DeviceCharacteristic = 0x00000100 IocapSafeAppend DeviceCharacteristic = 0x00000200 IocapSequential DeviceCharacteristic = 0x00000400 IocapUndeletableWhenOpen DeviceCharacteristic = 0x00000800 IocapPowersafeOverwrite DeviceCharacteristic = 0x00001000 IocapImmutable DeviceCharacteristic = 0x00002000 IocapBatchAtomic DeviceCharacteristic = 0x00004000 )
type ExtendedVFSv1 ¶
type File ¶
type File interface {
Close() error
// ReadAt reads len(p) bytes into p starting at offset off in the underlying input source.
// It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.
// If n < len(p), SQLITE_IOERR_SHORT_READ will be returned to sqlite.
ReadAt(p []byte, off int64) (n int, err error)
// WriteAt writes len(p) bytes from p to the underlying data stream at offset off.
// It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early.
// WriteAt must return a non-nil error if it returns n < len(p).
WriteAt(p []byte, off int64) (n int, err error)
Truncate(size int64) error
Sync(flag SyncType) error
FileSize() (int64, error)
// Acquire or upgrade a lock.
// elock can be one of the following:
// LockShared, LockReserved, LockPending, LockExclusive.
//
// Additional states can be inserted between the current lock level
// and the requested lock level. The locking might fail on one of the later
// transitions leaving the lock state different from what it started but
// still short of its goal. The following chart shows the allowed
// transitions and the inserted intermediate states:
//
// UNLOCKED -> SHARED
// SHARED -> RESERVED
// SHARED -> (PENDING) -> EXCLUSIVE
// RESERVED -> (PENDING) -> EXCLUSIVE
// PENDING -> EXCLUSIVE
//
// This function should only increase a lock level.
// See the sqlite source documentation for unixLock for more details.
Lock(elock LockType) error
// Lower the locking level on file to eFileLock. eFileLock must be
// either NO_LOCK or SHARED_LOCK. If the locking level of the file
// descriptor is already at or below the requested locking level,
// this routine is a no-op.
Unlock(elock LockType) error
// Check whether any database connection, either in this process or
// in some other process, is holding a RESERVED, PENDING, or
// EXCLUSIVE lock on the file. It returns true if such a lock exists
// and false otherwise.
CheckReservedLock() (bool, error)
// SectorSize returns the sector size of the device that underlies
// the file. The sector size is the minimum write that can be
// performed without disturbing other bytes in the file.
SectorSize() int64
// DeviceCharacteristics returns a bit vector describing behaviors
// of the underlying device.
DeviceCharacteristics() DeviceCharacteristic
}
type FileController ¶
type FileController interface {
// FileControl handles file control operations.
// For SQLITE_FCNTL_PRAGMA operations:
// - pragmaName contains the pragma name (e.g., "litestream_time")
// - pragmaValue contains the pragma value (nil for queries)
// Returns the result string (for queries) and any error.
// Return nil error with nil result for successful operations with no result.
FileControl(op int, pragmaName string, pragmaValue *string) (*string, error)
}
FileController is an optional interface that File implementations can implement to handle file control operations like PRAGMA commands.
type OpenFlag ¶
type OpenFlag int
const ( OpenReadOnly OpenFlag = 0x00000001 OpenReadWrite OpenFlag = 0x00000002 OpenCreate OpenFlag = 0x00000004 OpenDeleteOnClose OpenFlag = 0x00000008 OpenExclusive OpenFlag = 0x00000010 OpenAutoProxy OpenFlag = 0x00000020 OpenURI OpenFlag = 0x00000040 OpenMemory OpenFlag = 0x00000080 OpenMainDB OpenFlag = 0x00000100 OpenTempDB OpenFlag = 0x00000200 OpenTransientDB OpenFlag = 0x00000400 OpenMainJournal OpenFlag = 0x00000800 OpenTempJournal OpenFlag = 0x00001000 OpenSubJournal OpenFlag = 0x00002000 OpenSuperJournal OpenFlag = 0x00004000 OpenNoMutex OpenFlag = 0x00008000 OpenFullMutex OpenFlag = 0x00010000 OpenPrivateCache OpenFlag = 0x00040000 OpenWAL OpenFlag = 0x00080000 OpenNoFollow OpenFlag = 0x01000000 )
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithMaxPathName ¶
type VFS ¶
type VFS interface {
// Open a file.
// Name will either be the name of the file to open or "" for a temp file.
Open(name string, flags OpenFlag) (File, OpenFlag, error)
// Delete the named file. If dirSync is true them ensure the file-system
// modification has been synced to disk before returning.
Delete(name string, dirSync bool) error
// Test for access permission. Returns true if the requested permission is available.
Access(name string, flags AccessFlag) (bool, error)
// FullPathname returns the canonicalized version of name.
FullPathname(name string) string
}
Click to show internal directories.
Click to hide internal directories.