db

package
v0.0.0-...-063efc1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package db implements the database api for opkcat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name        string
	Description string
	Type        string
	Categories  []string
	Icon        []byte
}

type Handle

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

Handle is a database handle. It can be used to read and write data concurrently.

func Prod

func Prod(dbLocation, idxLocation string) (*Handle, error)

Prod returns a production version of the database in location.

func Test

func Test() (*Handle, error)

Test returns a test (in-memory) version of the database.

func (*Handle) Close

func (h *Handle) Close() error

func (*Handle) IndexURL

func (h *Handle) IndexURL(opkurl string) error

func (*Handle) KnownURLs

func (h *Handle) KnownURLs() ([]*URLFreshness, error)

func (*Handle) LastUpdated

func (h *Handle) LastUpdated(opkurl string) (time.Time, string, error)

func (*Handle) MultiUpdateRecord

func (h *Handle) MultiUpdateRecord(records []*Record) (int, error)

func (*Handle) Query

func (h *Handle) Query(qry string) ([]*Record, error)

func (*Handle) UpdateRecord

func (h *Handle) UpdateRecord(rec *Record) error

PutRecord will insert a record into the database. If the record already exist, it will be updated.

type Record

type Record struct {
	URL     string
	Hash    []byte
	Date    time.Time
	Etag    string
	Entries []*Entry
}

Record is the record that can be stored in the database.

type URLFreshness

type URLFreshness struct {
	URL        string
	LastUpdate time.Time
	Etag       string
}

Jump to

Keyboard shortcuts

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