localdb

package
v0.0.0-...-db4ab52 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserdbPath              = "users"
	LastPaywallAddressIndex = "lastpaywallindex"

	UserVersion    uint32 = 1
	UserVersionKey        = "userversion"
)

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func EncodeVersion

func EncodeVersion(version Version) ([]byte, error)

EncodeVersion encodes Version into a JSON byte slice.

func New

func New(root string) (*localdb, error)

New creates a new localdb instance.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Version

type Version struct {
	Version uint32 `json:"version"` // Database version
	Time    int64  `json:"time"`    // Time of record creation
}

Version contains the database version.

func DecodeVersion

func DecodeVersion(payload []byte) (*Version, error)

DecodeVersion decodes a JSON byte slice into a Version.

Jump to

Keyboard shortcuts

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