repo

package
Version: v0.0.0-...-97f5b14 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADR

type ADR interface {
	Get(int) (*ADR, error)
	Add(ADR) error
	Update(...ADR) error
	List() []*ADR
}

type FileRepo

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

func NewFileRepo

func NewFileRepo(dir string, newUnmarshaller func(io.Reader) serializer.Unmarshaller, newMarshaller func(io.Writer) serializer.Marshaller) FileRepo

NewFileRepo with provided unmarshalers and marshallers. Instantiates from the directory

func (FileRepo) Add

func (repo FileRepo) Add(newADR adr.ADR) error

Add a new adr to the repo. If one with that number already exists then it will return an error

func (FileRepo) Get

func (repo FileRepo) Get(n int) (*adr.ADR, error)

Get an adr by its id number (so, ADR-0001, pass in a '1') will return an error if it can't be found or on deserializetion problems

func (FileRepo) List

func (repo FileRepo) List() []*adr.ADR

List out the adrs in order

func (FileRepo) Update

func (repo FileRepo) Update(adrs ...adr.ADR) error

Update one or more pre-exisitng adrs. They will be rewritten with their new data in whatever storage mechanism is defined. This will use the Number to find/update them this will return an error if one of the adrs does not exist It will not update anything if one does not exist

Jump to

Keyboard shortcuts

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