ndb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 9 Imported by: 3

README

ndb: Network Database

this is an implementation of ndb(6) from plan 9.

see ndb for docs.

see ndbquery.go for an example program.

see ndb(6) for more information.

Documentation

Overview

Package ndb implements the Network Database described in http://plan9.bell-labs.com/magic/man2html/6/ndb.

Index

Constants

View Source
const (
	// Default NDB file
	NdbLocal = "/lib/ndb/local"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ndb

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

Ndb possibly comprised of multiple files.

func Open

func Open(fname string) (*Ndb, error)

Open an NDB database file.

func (*Ndb) Changed

func (n *Ndb) Changed() (bool, error)

Check if any db files changed.

func (*Ndb) Reopen

func (n *Ndb) Reopen() error

Reopen NDB file.

func (*Ndb) Search

func (n *Ndb) Search(attr, val string) RecordSet

Search for a record set with the given attr=val. Returns no records (nil) if not found.

type Record

type Record []Tuple

A NDB record, which may contain multiple tuples, and may span multiple lines in the file.

type RecordSet

type RecordSet []Record

RecordSet is a related group of records, from a single entry in ndb.

func (RecordSet) Search

func (r RecordSet) Search(attr string) string

Search a RecordSet for a given attribute and return the value. Returns "" if not present.

type Tuple

type Tuple struct {
	Attr, Val string
}

A single database attribute=value tuple. The value may be empty.

Directories

Path Synopsis
cmd
ndbquery command

Jump to

Keyboard shortcuts

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