data

package
v0.0.0-...-6c087f3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 7 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) Select

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

func (*Database) SelectAll

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

func (*Database) Start

func (db *Database) Start(_ context.Context) (_ <-chan error, err error)

func (*Database) Stop

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

func (*Database) String

func (db *Database) String() string

func (*Database) Update

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

type PersistentDatabase

type PersistentDatabase interface {
	Close() error
	StoreNewIP(domain, owner 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