pics

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package pics deals with the storage of pictures. The pictures are related to components and their filenames are composed like this:

<component-ID>_<position>.<extension>

Picture's position may be changed by changing <position>. They may also be deleted from the filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PictureName

type PictureName string

PictureName is the filename of a picture inside a PictureStore. It contains only the filename without any directories.

type PictureStore

type PictureStore struct {
	Path string // Path is the path to the picture directory.
}

func (PictureStore) Add

func (s PictureStore) Add(componentID int64, rawPic io.Reader) (PictureName, error)

Add adds a new picture for the component with componentID. It will be added at the next free position. An error will be returned, if the picture has not been added; this can happen if the picture does not meet some validation criteria.

func (PictureStore) Delete

func (s PictureStore) Delete(pictureName PictureName) error

Delete deletes the given picture from the filesystem. Pictures for the same component with a higher position will have their position decremented.

func (PictureStore) DeleteForComponent

func (s PictureStore) DeleteForComponent(componentID int64) error

DeleteForComponent deletes all pictures of the component with componentID.

func (PictureStore) Pictures

func (s PictureStore) Pictures(componentID int64) []PictureName

Pictures returns picture names of pictures for the component with componentID.

Jump to

Keyboard shortcuts

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