store

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCorrupt = fmt.Errorf("codedb index is corrupt")

ErrCorrupt indicates the index is corrupted and needs re-indexing.

Functions

func CreateSchema

func CreateSchema(db *sql.DB) error

CreateSchema initializes the SQLite tables and indexes.

Types

type Store

type Store struct {
	CodeIndex bleve.Index
	DiffIndex bleve.Index
	Root      string
	// contains filtered or unexported fields
}

Store wraps a SQLite database and Bleve full-text search indexes. All SQL access goes through the convenience methods below.

func Open

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

Open opens (or creates) a Store at the given root directory. It creates the directory structure, initializes SQLite and Bleve indexes. If SQLite corruption is detected, the database is removed and ErrCorrupt is returned so the caller can trigger a full re-index.

func (*Store) Begin

func (s *Store) Begin() (*sql.Tx, error)

Begin starts a new transaction.

func (*Store) BeginTx

func (s *Store) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

BeginTx starts a new transaction with the given context and options.

func (*Store) CheckIntegrity

func (s *Store) CheckIntegrity() error

CheckIntegrity validates that the SQLite database and both Bleve indexes are healthy. Returns nil if everything is fine, ErrCorrupt otherwise.

func (*Store) Close

func (s *Store) Close() error

Close closes all resources. It is safe to call multiple times.

func (*Store) Exec

func (s *Store) Exec(query string, args ...interface{}) (sql.Result, error)

Exec executes a SQL statement that doesn't return rows.

func (*Store) Query

func (s *Store) Query(query string, args ...interface{}) (*sql.Rows, error)

Query executes a SQL query and returns the rows.

func (*Store) QueryContext

func (s *Store) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

QueryContext executes a SQL query with context and returns the rows.

func (*Store) QueryRow

func (s *Store) QueryRow(query string, args ...interface{}) *sql.Row

QueryRow executes a SQL query expected to return at most one row.

func (*Store) ReposDir

func (s *Store) ReposDir() string

ReposDir returns the path to the bare git repos directory.

Jump to

Keyboard shortcuts

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