scroller

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0, GPL-3.0-or-later Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeRepo

type FakeRepo struct {
	Err                   error
	ErrOnImageExists      bool
	ErrOnCollectionExists bool
	NextImage             *im.BaseImage
	PreviousImage         *im.BaseImage
}

func (*FakeRepo) CollectionMustExist

func (r *FakeRepo) CollectionMustExist(collection string) error

func (*FakeRepo) GetAdjacent

func (r *FakeRepo) GetAdjacent(id im.ImageId, criteria ScrollingCriteria, d ScrollingDirection) (*im.BaseImage, error)

func (*FakeRepo) ImageMustExist

func (r *FakeRepo) ImageMustExist(id im.ImageId) error

type Interface

type Interface interface {
	Init(string, ...Option) (*ScrollerState, error)
}

type Option

type Option func(*ScrollingCriteria)

func WithCollection

func WithCollection(collection string) Option

type Repo

type Repo interface {
	GetAdjacent(im.ImageId, ScrollingCriteria, ScrollingDirection) (*im.BaseImage, error)
	ImageMustExist(imageId im.ImageId) error
	CollectionMustExist(string) error
}

type Scroller

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

func New

func New(repo Repo) Scroller

func (Scroller) Init

func (s Scroller) Init(imageIdStr string, opts ...Option) (*ScrollerState, error)

type ScrollerState

type ScrollerState struct {
	Next     *im.BaseImage
	Previous *im.BaseImage
}

type ScrollingCriteria

type ScrollingCriteria struct {
	Collection *string
}

func NewCriteria

func NewCriteria(opts ...Option) ScrollingCriteria

type ScrollingDirection

type ScrollingDirection int
const (
	ScrollNext ScrollingDirection = iota
	ScrollPrevious
)

Jump to

Keyboard shortcuts

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