db

package
v0.0.0-...-01d4b77 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Key

func Key(domain string, rtype uint16) (k string, err error)

Types

type DB

type DB struct {
	closer.Closer
	// contains filtered or unexported fields
}

func Open

func Open(cl closer.Closer, dbPath string) (d *DB, err error)

func (*DB) DeleteRecord

func (d *DB) DeleteRecord(key string) (err error)

func (*DB) GetRecord

func (d *DB) GetRecord(key string) (r Record, err error)

func (*DB) SetRecord

func (d *DB) SetRecord(key string, record Record) (err error)

type Record

type Record struct {
	RR      string `msg:"rr"`
	Expires int64  `msg:"expires"` // Unix timestamp. Never expires if <= 0
}

func (*Record) DecodeMsg

func (z *Record) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Record) EncodeMsg

func (z Record) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Record) MarshalMsg

func (z Record) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Record) Msgsize

func (z Record) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Record) UnmarshalMsg

func (z *Record) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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