database

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbParams

type DbParams struct {
	DatabaseFilePath string
	DoMigration      bool
	Logger           *log.Logger
}

type DbRow

type DbRow struct {
	RowId     int `db:"rowid"`
	Version   int
	Time      rfc3339.DateTime
	Component string
	Message   string
	Original  string
}

type InsertTuple

type InsertTuple struct {
	ParsedLog *v0.LineEnvelope
	Source    string
}

type LogsDatabase

type LogsDatabase struct {
	Connection   *sql.DB
	DatabaseFile string
	// contains filtered or unexported fields
}

func New

func New(params DbParams) (*LogsDatabase, error)

func (*LogsDatabase) BatchInsert

func (l *LogsDatabase) BatchInsert(tuples []InsertTuple) error

func (*LogsDatabase) Close

func (l *LogsDatabase) Close()

func (*LogsDatabase) GetAllLogs

func (l *LogsDatabase) GetAllLogs() (*SelectResult, error)

func (*LogsDatabase) Insert

func (l *LogsDatabase) Insert(tuple InsertTuple) error

func (*LogsDatabase) MigrateUp

func (l *LogsDatabase) MigrateUp() error

func (*LogsDatabase) Search

func (l *LogsDatabase) Search(term string) (*SelectResult, error)

func (*LogsDatabase) Select

func (l *LogsDatabase) Select(limit int, clause string) (*SelectResult, error)

type SelectResult

type SelectResult struct {
	Rows       []SelectedRow
	StartRowId int
	EndRowId   int
}

func (*SelectResult) ToLines

func (s *SelectResult) ToLines() []common.Envelope

ToLines converts the selection result into a set of parsed common.Envelope objects.

type SelectedRow

type SelectedRow struct {
	common.Envelope
	RowId    int
	Original string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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