zeventdb

package
v0.0.0-...-0521b85 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const TimeStampFormat = "2006-01-02 15:04:05.999999999"

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareItem

type CompareItem struct {
	Name   string
	Values []interface{}
}

type Database

type Database struct {
	DB           *sql.DB
	TableName    string
	TimeField    string
	PrimaryField string
	FieldInfos   []zsql.FieldInfo
	StructType   reflect.Type

	Lock sync.Mutex
	// contains filtered or unexported fields
}

func CreateDB

func CreateDB(relPath string, tableName string, istruct interface{}, deleteDays, deleteFreqSecs float64, indexFields []string) (db *Database, err error)

CreateDB creates (if *relPath* doesn't exist) a file and a sqlite DB pointer opened to it. It creates a table *tableName* using the structure istruct as its column names. The field with db:",primary" set, is the primary key. If there is more than one time.Time type, set db:",eventtime" tag to make it the event's time.

func (*Database) Add

func (db *Database) Add(istruct interface{}, flush bool)

func (*Database) DeleteEvent

func (db *Database) DeleteEvent(id int64) error

func (*Database) Get

func (db *Database) Get(resultsSlicePtr interface{}, equalItems zdict.Items, start, end time.Time, startID, endID int64, decending bool, keepID int64, count int) error

Jump to

Keyboard shortcuts

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