shelf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: CC-BY-SA-4.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const EntityPath = "entity"

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioEntity

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

func (*AudioEntity) Date

func (e *AudioEntity) Date() time.Time

func (*AudioEntity) Description

func (e *AudioEntity) Description() string

func (*AudioEntity) ID

func (e *AudioEntity) ID() string

func (*AudioEntity) MetaPath

func (e *AudioEntity) MetaPath() string

func (*AudioEntity) MimeType

func (e *AudioEntity) MimeType() string

func (*AudioEntity) Path

func (e *AudioEntity) Path() string

func (*AudioEntity) SystemPath

func (e *AudioEntity) SystemPath() string

type Entity

type Entity interface {
	ID() string
	Date() time.Time
	MimeType() string
	Description() string
	Path() string
	SystemPath() string
	MetaPath() string
}

type ImageEntity

type ImageEntity struct {
	Width  int `yaml:"width"`
	Height int `yaml:"height"`
	// contains filtered or unexported fields
}

func (*ImageEntity) Date

func (e *ImageEntity) Date() time.Time

func (*ImageEntity) Description

func (e *ImageEntity) Description() string

func (*ImageEntity) ID

func (e *ImageEntity) ID() string

func (*ImageEntity) MetaPath

func (e *ImageEntity) MetaPath() string

func (*ImageEntity) MimeType

func (e *ImageEntity) MimeType() string

func (*ImageEntity) Path

func (e *ImageEntity) Path() string

func (*ImageEntity) SystemPath

func (e *ImageEntity) SystemPath() string

type Moment

type Moment struct {
	Date   time.Time `yaml:"date"`
	Title  string    `yaml:"title"`
	Author string    `yaml:"author"`
	Text   string    `yaml:"text"`
}

func (*Moment) DateString

func (m *Moment) DateString() string

func (*Moment) Path

func (m *Moment) Path() string

type Shelf

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

季節の書架

func New

func New(storage *Storage) *Shelf

func (*Shelf) AddImageEntity

func (shelf *Shelf) AddImageEntity(mimeType string, buffer []byte) (*ImageEntity, error)

func (*Shelf) AddVideoEntity

func (shelf *Shelf) AddVideoEntity(mimeType string, r io.Reader) (*VideoEntity, error)

func (*Shelf) FindAllEntities

func (shelf *Shelf) FindAllEntities() []Entity

func (*Shelf) FindAllEntitiesByYear

func (shelf *Shelf) FindAllEntitiesByYear(year int) []Entity

func (*Shelf) FindAllMoments

func (shelf *Shelf) FindAllMoments() []*Moment

func (*Shelf) FindAllMomentsByYear

func (shelf *Shelf) FindAllMomentsByYear(year int) []*Moment

func (*Shelf) Init

func (shelf *Shelf) Init() error

func (*Shelf) LookupEntity

func (shelf *Shelf) LookupEntity(id string) Entity

func (*Shelf) LookupMoment

func (shelf *Shelf) LookupMoment(path string) *Moment

func (*Shelf) NumEntities

func (shelf *Shelf) NumEntities() int

func (*Shelf) NumMoments

func (shelf *Shelf) NumMoments() int

func (*Shelf) RemoveEntity

func (shelf *Shelf) RemoveEntity(entity Entity) error

func (*Shelf) SaveMoment

func (shelf *Shelf) SaveMoment(origTime time.Time, m *Moment) error

type Storage

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

func NewStorage

func NewStorage(dirPath string) (*Storage, error)

func (*Storage) CreateFile

func (s *Storage) CreateFile(path string) (*os.File, error)

func (*Storage) Exists

func (s *Storage) Exists(path string) bool

func (*Storage) Mkdir

func (s *Storage) Mkdir(path string) error

func (*Storage) OpenFile

func (s *Storage) OpenFile(path string) (*os.File, error)

func (*Storage) OpenTempFile

func (s *Storage) OpenTempFile(ext string) (string, *os.File, error)

func (*Storage) ReadFile

func (s *Storage) ReadFile(path string) ([]byte, error)

func (*Storage) Remove

func (s *Storage) Remove(path string) error

func (*Storage) Rename

func (s *Storage) Rename(old, new string) error

func (*Storage) RenameFileWithBytes

func (s *Storage) RenameFileWithBytes(old, new string, content []byte) error

func (*Storage) UpdateFileWithBytes

func (s *Storage) UpdateFileWithBytes(path string, content []byte) error

func (*Storage) UpdateFileWithReader

func (s *Storage) UpdateFileWithReader(path string, reader io.Reader) error

func (*Storage) UpdateFileWithTempFile

func (s *Storage) UpdateFileWithTempFile(path string, tmpFile *os.File) error

func (*Storage) WalkFiles

func (s *Storage) WalkFiles(path string, fn func(path string, info os.FileInfo, err error) error) error

func (*Storage) WriteFile

func (s *Storage) WriteFile(path string, content []byte) error

type VideoEntity

type VideoEntity struct {
	Width    int     `yaml:"width"`
	Height   int     `yaml:"height"`
	Duration float64 `yaml:"duraton"`
	// contains filtered or unexported fields
}

func (*VideoEntity) Date

func (e *VideoEntity) Date() time.Time

func (*VideoEntity) Description

func (e *VideoEntity) Description() string

func (*VideoEntity) ID

func (e *VideoEntity) ID() string

func (*VideoEntity) MetaPath

func (e *VideoEntity) MetaPath() string

func (*VideoEntity) MimeType

func (e *VideoEntity) MimeType() string

func (*VideoEntity) Path

func (e *VideoEntity) Path() string

func (*VideoEntity) SystemPath

func (e *VideoEntity) SystemPath() string

Jump to

Keyboard shortcuts

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