package db
import "github.com/TLop503/LogCrunch/server/db"
Index
- func InitDB(dbPath string) (*sql.DB, error)
- func InsertLog(db *sql.DB, l structs.Log) error
- func InsertLogsBatch(db *sql.DB, logs []structs.Log) error
- func InsertModule(db *sql.DB, m DBModule) error
- func LoadModulesFromRegistry(db *sql.DB) error
- func MostRecent50(db *sql.DB) ([]structs.Log, error)
- func PrintAllModules(db *sql.DB) error
- func RunQuery(db *sql.DB, query string) ([]structs.Log, error)
- type DBModule
Functions
func InitDB
func InitDB(dbPath string) (*sql.DB, error)
InitDB initializes the SQLite database with tables and indexes. dbPath is the path to the .sqlite file.
func InsertLog
func InsertLog(db *sql.DB, l structs.Log) error
InsertLog, allowing FKs to not necessarily exist yet
func InsertLogsBatch
func InsertLogsBatch(db *sql.DB, logs []structs.Log) error
insert many logs at a time in batches for high-throughput
func InsertModule
func InsertModule(db *sql.DB, m DBModule) error
InsertModule inserts a module into the database, replacing it if it already exists
func LoadModulesFromRegistry
func LoadModulesFromRegistry(db *sql.DB) error
LoadModulesFromRegistry adds the contents of the metaparser reg to the database
func MostRecent50
func MostRecent50(db *sql.DB) ([]structs.Log, error)
func PrintAllModules
func PrintAllModules(db *sql.DB) error
PrintAllModules queries the modules table and prints each module name for debugging
func RunQuery
func RunQuery(db *sql.DB, query string) ([]structs.Log, error)
Types
type DBModule
type DBModule struct { Name string Schema string // JSON string }
Module represents a parser module and its schema