image

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	Caption string
}

CreateInput is a new gallery photo; the image is required.

type Handlers

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

Handlers serves /gallery.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

func (h *Handlers) Register(g *echo.Group, guards web.Guards)

Register mounts the gallery routes on the /api/v1 group. Photographers may write; Managers may not.

type Image

type Image struct {
	ID       int         `db:"id" json:"id"`
	FileName string      `db:"file_name" json:"file_name"`
	Caption  null.String `db:"caption" json:"caption"`
}

type Public

type Public struct {
	ID       int    `json:"id"`
	Caption  string `json:"caption,omitempty"`
	ImageURL string `json:"imageUrl"`
}

Public is a gallery photo as the API returns it.

type Service

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

Service is the gallery business logic.

func NewService

func NewService(store store, files *upload.Files) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, in CreateInput, photo *upload.File) (Public, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id int) (Public, error)

Delete removes the photo and its file, returning what was deleted.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Public, error)

type Store

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

Store stores the dependencies

func NewImageRepo

func NewImageRepo(db *sqlx.DB) *Store

NewImageRepo stores our dependency

func (*Store) AddImage

func (s *Store) AddImage(ctx context.Context, imageParam Image) (Image, error)

func (*Store) DeleteImage

func (s *Store) DeleteImage(ctx context.Context, imageParam Image) error

func (*Store) GetImage

func (s *Store) GetImage(ctx context.Context, imageParam Image) (Image, error)

func (*Store) GetImages

func (s *Store) GetImages(ctx context.Context) ([]Image, error)

Jump to

Keyboard shortcuts

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