table

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package table contains an Impl that wraps a given key of another Impl.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoParent = errors.New("table has no parent (closed?)")

ErrNoParent occurs when the Table has no Parent.

Functions

This section is empty.

Types

type Table

type Table struct {
	Parent impl.Impl
	Key    string
	Mem    *mem.Mem
}

Table is an Impl that wraps a given Key of a Parent Impl.

func NewTable

func NewTable(p impl.Impl, k string) *Table

NewTable returns a Table which wraps the given Key of the given Parent.

func (*Table) Close

func (t *Table) Close() error

Close nils the Table's Parent and closes its Mem.

func (*Table) Del

func (t *Table) Del(k string) error

Del loads the Table, removes a key, and then saves the Table.

func (*Table) Get

func (t *Table) Get(k string) ([]byte, error)

Get loads the Table and retrieves the data at a given key.

func (*Table) Keys

func (t *Table) Keys() ([]string, error)

Keys loads the Table and returns a list of its keys.

func (*Table) Load

func (t *Table) Load() error

Load fetches the Table's data from the Parent, and unmarshals it into its Mem.

func (*Table) Name

func (t *Table) Name() string

Name returns the Table's Key. Recurses in the form "x.y.z" if the Parent is also a Table.

func (*Table) Save

func (t *Table) Save() error

Save marshals the Table's Mem, and stores the data in the Parent.

func (*Table) Set

func (t *Table) Set(k string, v []byte) error

Set loads the Table, writes a given value at the given key, and saves the Table.

Jump to

Keyboard shortcuts

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