db

package
v0.0.0-...-3948e75 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCollection = Collection{

	FormulaURL: "https://hyperelliptic.org/EFD/CLASS/auto-SHAPE-REPRESENTATION.html#OPERATION-TAG",
}

DefaultCollection specifies information about the original EFD database.

Functions

func ParseProperties

func ParseProperties(r io.Reader) (map[string][]string, error)

func Walk

func Walk(s Store, v Visitor) error

Walk walks the Store, calling the Visitor for every file.

Types

type Collection

type Collection struct {
	FormulaURL string
}

Collection specifies information about a collection of data included in the database.

type Database

type Database struct {
	Collections     map[string]*Collection
	Shapes          map[string]*efd.Shape
	Representations map[string]*efd.Representation
	Formulae        map[string]*efd.Formula
}

func New

func New() *Database

func Read

func Read(s Store) (*Database, error)

type File

type File interface {
	// Path relative to Store root.
	Path() string

	io.ReadCloser
}

File in a Store.

type Key

type Key struct {
	Path           string
	Collection     string
	Class          string
	Section        string
	Shape          string
	Representation string
	Operation      string
	Name           string
	Ext            string
}

func KeyFromFilename

func KeyFromFilename(filename string) Key

func (Key) FormulaID

func (k Key) FormulaID() string

func (Key) IsFormula

func (k Key) IsFormula() bool

func (Key) IsOP3

func (k Key) IsOP3() bool

func (Key) IsRepresentation

func (k Key) IsRepresentation() bool

func (Key) IsShape

func (k Key) IsShape() bool

func (Key) OperationID

func (k Key) OperationID() string

func (Key) RepresentationID

func (k Key) RepresentationID() string

func (Key) ShapeID

func (k Key) ShapeID() string

type Store

type Store interface {
	Next() (File, error)
	io.Closer
}

Store is a method of accessing database files.

func Archive

func Archive(filename string) (Store, error)

Archive opens a gzipped tarball database.

func Directory

func Directory(root string) (Store, error)

Directory opens a database stored at root.

func Merge

func Merge(stores ...Store) Store

Merge multiple database stores into one.

func Open

func Open(filename string) (Store, error)

Open is a convenience for opening a database. It will make an informed guess about the storage format.

type Visitor

type Visitor interface {
	Visit(f File) error
}

Visitor provides a Visit method that is called for every file visited by Walk. The visit method receives the filename within the Store, as well as a reader for the contents.

type VisitorFunc

type VisitorFunc func(f File) error

VisitorFunc adapts a plain function to the Visitor interface.

func (VisitorFunc) Visit

func (v VisitorFunc) Visit(f File) error

Visit calls v.

Jump to

Keyboard shortcuts

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