Documentation
¶
Overview ¶
Package sqlite provides a lightweight SQLite database wrapper using the modernc.org/sqlite driver (pure Go, no CGO required).
Index ¶
- type ColumnInfo
- type DB
- func (db *DB) Close() error
- func (db *DB) Exec(stmt string, args ...interface{}) (sql.Result, error)
- func (db *DB) ForeignKeyInfo(tableName string) ([]ForeignKeyInfo, error)
- func (db *DB) Path() string
- func (db *DB) Query(query string, args ...interface{}) ([]map[string]interface{}, error)
- func (db *DB) QueryScalar(query string, args ...interface{}) (interface{}, error)
- func (db *DB) RowCount(tableName string) (int64, error)
- func (db *DB) TableInfo(tableName string) ([]ColumnInfo, error)
- func (db *DB) TableNames() ([]string, error)
- type ForeignKeyInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
Ordinal int
Name string
Type string
NotNull bool
Default *string
PrimaryKey bool
}
ColumnInfo holds information about a database column.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a SQLite database connection with helper methods.
func (*DB) ForeignKeyInfo ¶
func (db *DB) ForeignKeyInfo(tableName string) ([]ForeignKeyInfo, error)
ForeignKeyInfo returns foreign key information for a table.
func (*DB) QueryScalar ¶
QueryScalar executes a query and returns a single scalar value.
func (*DB) TableInfo ¶
func (db *DB) TableInfo(tableName string) ([]ColumnInfo, error)
TableInfo returns column information for a table.
func (*DB) TableNames ¶
TableNames returns a list of all table names in the database.
Click to show internal directories.
Click to hide internal directories.