sort

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

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

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

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

func NewExifSorter(ctx context.Context, uri string) (Sorter, error)

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

func NewModTimeSorter(ctx context.Context, uri string) (Sorter, error)

NewModTimeSorter returns a new instance of `ModTimeSorter` for 'uri' which must be parsable as a valid `net/url` URL instance.

func NewSorter

func NewSorter(ctx context.Context, uri string) (Sorter, error)

NewSorter returns a new `Sorter` instance for 'uri' whose scheme is expected to have been associated with an `SorterInitializeFunc` (by the `RegisterSorter` method.

type SorterInitializeFunc

type SorterInitializeFunc func(context.Context, string) (Sorter, error)

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.

Jump to

Keyboard shortcuts

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