Documentation
¶
Overview ¶
Package sqlite provides a SQLite3 database utils.
Index ¶
- func Compact(ctx context.Context, db *sql.DB) error
- func Open(file string, opts ...OpOption) (*sql.DB, error)
- func OpenTestDB(t *testing.T) (*sql.DB, *sql.DB, func())
- func ReadDBSize(ctx context.Context, db *sql.DB) (uint64, error)
- func RecordDelete(tookSeconds float64)
- func RecordInsertUpdate(tookSeconds float64)
- func RecordSelect(tookSeconds float64)
- func Register(reg *prometheus.Registry) error
- type Metrics
- type Op
- type OpOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordDelete ¶ added in v0.4.0
func RecordDelete(tookSeconds float64)
func RecordInsertUpdate ¶ added in v0.4.0
func RecordInsertUpdate(tookSeconds float64)
func RecordSelect ¶ added in v0.4.0
func RecordSelect(tookSeconds float64)
func Register ¶ added in v0.4.0
func Register(reg *prometheus.Registry) error
Types ¶
type Metrics ¶ added in v0.4.0
type Metrics struct { Time time.Time // The total number of inserts and updates in cumulative count. InsertUpdateTotal int64 InsertUpdateSecondsTotal float64 InsertUpdateSecondsAvg float64 // The total number of deletes in cumulative count. DeleteTotal int64 DeleteSecondsTotal float64 DeleteSecondsAvg float64 // The total number of selects in cumulative count. SelectTotal int64 SelectSecondsTotal float64 SelectSecondsAvg float64 }
func ReadMetrics ¶ added in v0.4.0
func ReadMetrics(gatherer prometheus.Gatherer) (Metrics, error)
type OpOption ¶ added in v0.3.8
type OpOption func(*Op)
func WithReadOnly ¶ added in v0.3.8
ref. https://github.com/mattn/go-sqlite3/issues/1179#issuecomment-1638083995
Click to show internal directories.
Click to hide internal directories.