database

package
v0.0.0-...-0d94b02 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BucketHistory  = "history"
	BucketMappings = "mappings"
)
View Source
const (
	MappingTypeUID   = "uid"
	MappingTypeText  = "text"
	MappingTypeData  = "data"
	MatchTypeExact   = "exact"
	MatchTypePartial = "partial"
	MatchTypeRegex   = "regex"
)

Variables

Functions

func DbExists

func DbExists() bool

Check if the db exists on disk.

func HistoryKey

func HistoryKey(entry HistoryEntry) string

func MappingsKey

func MappingsKey(id string) string

func NormalizeUid

func NormalizeUid(uid string) string

Types

type Database

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

func Open

func Open() (*Database, error)

func (*Database) AddHistory

func (d *Database) AddHistory(entry HistoryEntry) error

func (*Database) AddMapping

func (d *Database) AddMapping(m Mapping) error

func (*Database) Close

func (d *Database) Close() error

func (*Database) DeleteMapping

func (d *Database) DeleteMapping(id string) error

func (*Database) GetAllMappings

func (d *Database) GetAllMappings() ([]Mapping, error)

func (*Database) GetEnabledMappings

func (d *Database) GetEnabledMappings() ([]Mapping, error)

func (*Database) GetHistory

func (d *Database) GetHistory() ([]HistoryEntry, error)

func (*Database) GetMapping

func (d *Database) GetMapping(id string) (Mapping, error)

func (*Database) UpdateMapping

func (d *Database) UpdateMapping(id string, m Mapping) error

type HistoryEntry

type HistoryEntry struct {
	Time    time.Time `json:"time"`
	Type    string    `json:"type"`
	UID     string    `json:"uid"`
	Text    string    `json:"text"`
	Data    string    `json:"data"`
	Success bool      `json:"success"`
}

TODO: reader source (physical reader vs web) TODO: metadata

type Mapping

type Mapping struct {
	Id       string `json:"id"`
	Added    int64  `json:"added"`
	Label    string `json:"label"`
	Enabled  bool   `json:"enabled"`
	Type     string `json:"type"`
	Match    string `json:"match"`
	Pattern  string `json:"pattern"`
	Override string `json:"override"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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