data

package
v0.0.0-...-542e895 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRecordNotFound = errors.New("record not found")

Functions

This section is empty.

Types

type Database

type Database struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(data []records.Record, persistentDB PersistentDatabase) *Database

NewDatabase creates a new in memory database.

func (*Database) Close

func (db *Database) Close() (err error)

func (*Database) Select

func (db *Database) Select(id uint) (record records.Record, err error)

func (*Database) SelectAll

func (db *Database) SelectAll() (records []records.Record)

func (*Database) Update

func (db *Database) Update(id uint, record records.Record) (err error)

type PersistentDatabase

type PersistentDatabase interface {
	Close() error
	StoreNewIP(domain, host string, ip netip.Addr, t time.Time) (err error)
}

Jump to

Keyboard shortcuts

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