Documentation
¶
Index ¶
- func SortPhotoSlice(photos []Photo)
- func SortPhotos(photos Photos)
- type DateNamer
- type Namer
- type NamerFunc
- type Observer
- type Photo
- type Photos
- type Photowall
- type Processor
- type ProcessorFunc
- type Resizer
- type Store
- type Wall
- func (w *Wall) AddPhoto(p Photo) error
- func (w *Wall) AddPhotoFromFile(name string, createdAt time.Time) error
- func (w *Wall) OnAdd(o Observer)
- func (w *Wall) OnRemove(o Observer)
- func (w Wall) Photos() Photos
- func (w *Wall) Processors() []Processor
- func (w *Wall) RemovePhoto(photo Photo)
- func (w *Wall) SetProcessors(ps []Processor)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DateNamer ¶
type DateNamer struct {
// contains filtered or unexported fields
}
DateNamer represents name generator based on date/time
func NewDateNamer ¶
NewDateNamer generates a new name generator based on date/time
type Photo ¶
type Photo interface {
Name() string
Bounds() image.Rectangle // width, height
Format() string // png, jpeg
CreatedAt() time.Time
}
Photo represents a photo on the photowall
type Photos ¶
type Photos []Photo
Photos is a collection of photos
type Photowall ¶
type Photowall interface {
AddPhotoFromFile(name string, createdAt time.Time) error
AddPhoto(p Photo) error
RemovePhoto(photo Photo)
OnAdd(o Observer)
OnRemove(o Observer)
Photos() Photos
}
Photowall represents a wall of photos
type ProcessorFunc ¶
ProcessorFunc can be used instead of the Processor type
type Resizer ¶
Resizer resizes photos
func NewResizer ¶
NewResizer creates a new instance of Resizer
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store processes photos, stores them inside a given directory and checks for duplicates
type Wall ¶
type Wall struct {
// contains filtered or unexported fields
}
Wall represents a collection of photos, create with Create
func Create ¶
func Create() *Wall
Create a new photowall
Processors should be set after creation
wall.SetProcessors([]Processor{
NewResizer(1920, 1080),
NewStore("./storage"),
})
func (*Wall) AddPhotoFromFile ¶
AddPhotoFromFile adds a new photo to the wall
func (*Wall) OnRemove ¶
OnRemove registers an Observer which is called when a photo was removed to the wall
func (*Wall) Processors ¶
Processors returns the list of registered processors
func (*Wall) RemovePhoto ¶
RemovePhoto removes a photo from the wall
func (*Wall) SetProcessors ¶
SetProcessors sets the list of registered processors