database

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package database provides SQLite database connection and query functionality

Index

Constants

View Source
const (
	// InMemoryDB represents the SQLite in-memory database identifier
	InMemoryDB = ":memory:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps a SQLite database connection with common operations

func New

func New(dbPath string, readOnly bool) (*DB, error)

New creates a new database connection

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection

func (*DB) Execute

func (db *DB) Execute(statement string, args ...interface{}) (int64, error)

Execute runs an INSERT, UPDATE, or DELETE statement

func (*DB) GetTableSchema

func (db *DB) GetTableSchema(tableName string) ([]map[string]interface{}, error)

GetTableSchema returns the schema information for a specific table

func (*DB) GetTables

func (db *DB) GetTables() ([]string, error)

GetTables returns a list of all tables in the database

func (*DB) Path

func (db *DB) Path() string

Path returns the database file path

func (*DB) Query

func (db *DB) Query(query string, args ...interface{}) ([]map[string]interface{}, error)

Query executes a SELECT query and returns the results

Jump to

Keyboard shortcuts

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