Documentation ¶
Overview ¶
package sort provides a common interface for sorting a list of images to be included in a picturebook.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableSorters ¶
func AvailableSorters() []string
AvailableSorters returns the list of schemes that have been registered with `SorterInitializeFunc` functions.
func RegisterSorter ¶
func RegisterSorter(ctx context.Context, name string, fn SorterInitializeFunc) error
RegisterSorter associates a URI scheme with a `SorterInitializeFunc` initialization function.
Types ¶
type ExifSorter ¶ added in v0.4.6
type ExifSorter struct {
Sorter
}
type ExifSorter implements the `Sorter` interface to sort a list of `picture.PictureBookPicture` by their EXIF DateTime properties.
func (*ExifSorter) Sort ¶ added in v0.4.6
func (f *ExifSorter) Sort(ctx context.Context, bucket *blob.Bucket, pictures []*picture.PictureBookPicture) ([]*picture.PictureBookPicture, error)
Sort sorts a list of `picture.PictureBookPicture` by their EXIF DateTime properties. If an image does not have an EXIF DateTime property it is excluded from the sorted result set.
type ModTimeSorter ¶ added in v0.2.2
type ModTimeSorter struct {
Sorter
}
type ModTimeSorter implements the `Sorter` interface to sort a list of `picture.PictureBookPicture` by their modification dates.
func (*ModTimeSorter) Sort ¶ added in v0.2.2
func (f *ModTimeSorter) Sort(ctx context.Context, bucket *blob.Bucket, pictures []*picture.PictureBookPicture) ([]*picture.PictureBookPicture, error)
Sort sorts a list of `picture.PictureBookPicture` by their modification dates.
type Sorter ¶
type Sorter interface { // Sort takes a list of `picture.PictureBookPicture` instances that are stored in a gocloud.dev/blob Bucket instance and returns new list of sorted picture.PictureBookPicture instances. Sort(context.Context, *blob.Bucket, []*picture.PictureBookPicture) ([]*picture.PictureBookPicture, error) }
type Sorter provides a common interface for sorting a list of images to be included in a picturebook.
func NewExifSorter ¶ added in v0.4.6
NewExifSorter returns a new instance of `ExifSorter` for 'uri' which must be parsable as a valid `net/url` URL instance.
func NewModTimeSorter ¶ added in v0.2.2
NewModTimeSorter returns a new instance of `ModTimeSorter` for 'uri' which must be parsable as a valid `net/url` URL instance.
type SorterInitializeFunc ¶
type SorterInitializeFunc defined a common initialization function for instances implementing the Sorter interface. This is specified when the packages definining those instances call `RegisterSorter` and invoked with the `NewSorter` method is called.