Documentation
¶
Index ¶
- Variables
- func CreateSchema(db *sql.DB) error
- type Store
- func (s *Store) Begin() (*sql.Tx, error)
- func (s *Store) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (s *Store) CheckIntegrity() error
- func (s *Store) Close() error
- func (s *Store) Exec(query string, args ...interface{}) (sql.Result, error)
- func (s *Store) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (s *Store) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (s *Store) QueryRow(query string, args ...interface{}) *sql.Row
- func (s *Store) ReposDir() string
Constants ¶
This section is empty.
Variables ¶
var ErrCorrupt = fmt.Errorf("codedb index is corrupt")
ErrCorrupt indicates the index is corrupted and needs re-indexing.
Functions ¶
func CreateSchema ¶
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 ¶
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) CheckIntegrity ¶
CheckIntegrity validates that the SQLite database and both Bleve indexes are healthy. Returns nil if everything is fine, ErrCorrupt otherwise.
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.