collection

package
v0.0.0-...-de2183f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BarsStoreName = "bars"
	InfoItemName  = "info.json"
)

Variables

This section is empty.

Functions

func BarsItemName

func BarsItemName(sym string, d date.Date) string

func Exists

func Exists(store Store) bool

func ExtractDate

func ExtractDate(s string) (date.Date, bool)

func Load

func Load(store Store) (models.Collection, error)

func LoadFromDir

func LoadFromDir(dir string) (models.Collection, error)

func New

func New(info *models.CollectionInfo, store Store) (models.Collection, error)

Types

type DateIndex

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

func NewDateIndex

func NewDateIndex(s Store) *DateIndex

func (*DateIndex) AddItem

func (idx *DateIndex) AddItem(name string, d date.Date)

func (*DateIndex) Empty

func (idx *DateIndex) Empty() bool

func (*DateIndex) FindItem

func (idx *DateIndex) FindItem(d date.Date) (string, bool)

func (*DateIndex) FirstDate

func (idx *DateIndex) FirstDate() date.Date

func (*DateIndex) LastDate

func (idx *DateIndex) LastDate() date.Date

func (*DateIndex) Update

func (idx *DateIndex) Update()

type DateIndexEntry

type DateIndexEntry struct {
	Date     date.Date
	ItemName string
}

type DirStore

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

func (*DirStore) ItemNames

func (store *DirStore) ItemNames() []string

func (*DirStore) LoadItem

func (store *DirStore) LoadItem(name string) ([]byte, error)

func (*DirStore) MakeSubstore

func (store *DirStore) MakeSubstore(name string) (Store, error)

func (*DirStore) StoreItem

func (store *DirStore) StoreItem(name string, data []byte) error

func (*DirStore) Substore

func (store *DirStore) Substore(name string) (Store, error)

func (*DirStore) SubstoreNames

func (store *DirStore) SubstoreNames() []string

type ErrNotDir

type ErrNotDir struct {
	Path string
}

func (*ErrNotDir) Error

func (err *ErrNotDir) Error() string

type ErrNotFile

type ErrNotFile struct {
	Path string
}

func (*ErrNotFile) Error

func (err *ErrNotFile) Error() string

type Store

type Store interface {
	MakeSubstore(name string) (Store, error)
	SubstoreNames() []string
	Substore(name string) (Store, error)

	ItemNames() []string
	LoadItem(name string) ([]byte, error)
	StoreItem(name string, data []byte) error
}

func NewDirStore

func NewDirStore(root string) (Store, error)

Jump to

Keyboard shortcuts

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