history

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package history records the statements a user has run, so they can be found again.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the on-disk location, alongside the catalog cache.

Types

type Entry

type Entry struct {
	DataSource string
	SQL        string
	Rows       int
	Elapsed    time.Duration
	At         time.Time
}

Entry is one recorded statement.

type Store

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

Store holds the history on disk.

func Open

func Open(path string) (*Store, error)

Open opens or creates the history at path.

func (*Store) Add

func (s *Store) Add(ctx context.Context, e Entry) error

Add records a statement.

Re-running a statement updates the existing row rather than adding another, so a query run in a loop does not crowd out everything else.

func (*Store) Close

func (s *Store) Close() error

Close releases the database handle.

func (*Store) Search

func (s *Store) Search(ctx context.Context, term string, limit int) ([]Entry, error)

Search returns matching entries, newest first. An empty term lists everything.

Jump to

Keyboard shortcuts

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