sqlite

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBusyTimeout              = 5 * time.Second
	DefaultQueryTimeout             = 30 * time.Second
	JournalModeWAL      JournalMode = "WAL"
	JournalModeMemory   JournalMode = "MEMORY"
	JournalModeOff      JournalMode = "OFF"
	BigCacheSize                    = 20000
	NormalCacheSize                 = 2000 // This is actually the sqlite default
	SyncOff             SyncMode    = "OFF"
	SyncNormal          SyncMode    = "NORMAL"
	AccessModeRWC       AccessMode  = "rwc"
	AccessModeMemory    AccessMode  = "memory"
)
View Source
const (
	InMemoryDBName = ":memory:"
)
View Source
const SQLiteDriver = "sqlite3"

Variables

View Source
var (
	DefaultDatabase   = "scrape_data/scrape.db"
	ErrDatabaseExists = errors.New("database already exists")
	ErrIsInMemory     = errors.New("file path is in-memory DB (':memory:')")
)
View Source
var MigrationFS embed.FS

Functions

This section is empty.

Types

type AccessMode

type AccessMode string

type FilesystemStats

type FilesystemStats struct {
	Path    string `json:"path"`
	TotalMB uint   `json:"total_mb"`
	UsedMB  uint   `json:"used_mb"`
	FreeMB  uint   `json:"free_mb"`
	AvailMB uint   `json:"avail_mb"`
}

type JournalMode

type JournalMode string

type Option

type Option func(*config) error

func Defaults

func Defaults() Option

Defaults always get applied in the New() function

func File

func File(filename string) Option

func InMemoryDB

func InMemoryDB() Option

func WithQueryTimeout

func WithQueryTimeout(timeout time.Duration) Option

func WithoutAutoCreate

func WithoutAutoCreate() Option

type SQLite

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

func MustNew

func MustNew(options ...Option) *SQLite

func New

func New(options ...Option) (*SQLite, error)

func (*SQLite) AfterOpen

func (s *SQLite) AfterOpen(dbh *database.DBHandle) error

func (SQLite) DSNSource

func (s SQLite) DSNSource() database.DataSource

func (SQLite) Driver

func (s SQLite) Driver() string

func (*SQLite) Maintain

func (s *SQLite) Maintain(dbh *database.DBHandle) error

func (SQLite) MigrationFS

func (s SQLite) MigrationFS() *embed.FS

func (*SQLite) Stats

func (s *SQLite) Stats(dbh *database.DBHandle) (any, error)

Implements the store.Observable interface. Return value intended to be included in JSON outputs. For introspection of the results, type assert to *sqlite.Stats.

type Stats

type Stats struct {
	SqliteVersion string           `json:"sqlite_version"`
	PageCount     int              `json:"page_count"`
	PageSize      int              `json:"page_size"`
	UnusedPages   int              `json:"unused_pages"`
	MaxPageCount  int              `json:"max_page_count"`
	Filesystem    *FilesystemStats `json:"fs,omitempty"`
	DBStats       any              `json:"db_stats,omitempty"`
	// contains filtered or unexported fields
}

func (*Stats) DatabaseSizeMB

func (s *Stats) DatabaseSizeMB() int

type SyncMode

type SyncMode string

Jump to

Keyboard shortcuts

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