db_handler

package
v0.0.0-...-049c0e3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DB_FILENAME           = "logs.db"
	DB_LOG_CREATE_COMMAND = `` /* 162-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func CreateInsertQuery

func CreateInsertQuery(q interface{}) (*string, error)

Types

type DbLogReader

type DbLogReader interface {
	GetLogs() []Log
	GetLogsNewerThan(int) []Log
}

Allows to read logs from DB

type DbLogger

type DbLogger interface {
	Log(int64, int, string, string)
	LogData(*Log)
}

Allows to store logs in DB

type Log

type Log struct {
	ID    string
	Time  string
	Level string
	Ctx   string
	Msg   string
}

type SQLiteDb

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

SQLite handler implementation

func (*SQLiteDb) Close

func (sqlDb *SQLiteDb) Close()

func (*SQLiteDb) GetLogs

func (sqlDb *SQLiteDb) GetLogs() []Log

func (*SQLiteDb) GetLogsNewerThan

func (sqlDb *SQLiteDb) GetLogsNewerThan(lastLogId int) []Log

func (*SQLiteDb) Log

func (sqlDb *SQLiteDb) Log(time int64, level int, ctx string, msg string)

func (*SQLiteDb) LogData

func (sqlDb *SQLiteDb) LogData(log *Log)

func (*SQLiteDb) Open

func (sqlDb *SQLiteDb) Open() error

Starts connection to SQLite and create log table if not exists

Jump to

Keyboard shortcuts

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