imginfo

package
v0.0.0-...-88e771d Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewImage

func NewImage(id string, name string, tags []string) *image

NewPicture creates a new Image object

func NewPicture

func NewPicture(id string, url string, resolution string) *picture

NewPicture creates a new Picture object

Types

type Image

type Image interface {
	ID() string     // UUID of this picture info group
	Name() string   // "Really cool picture 800x600"
	Tags() []string // tags for this picture, e.g. "cat", "dog"

	AddPicture(pic Picture) error // Append new picture to image
	Pictures() []Picture          // Slice of of PictureInfo with the same image
}

Group of PictureInfo with the same image. For example it can be same image with different resolution.

type ImageJSON

type ImageJSON struct {
	ID       string        `json:"id"`
	Name     string        `json:"name"`
	Tags     []string      `json:"tags"`
	Pictures []PictureJSON `json:"pictures"`
}

func NewImageJSON

func NewImageJSON(img Image) *ImageJSON

type ImageRepo

type ImageRepo interface {
	// Put stores a Image into repository.
	Put(ctx context.Context, img Image) error

	Get(ctx context.Context, reqImg Image) (Image, error)
}

ImageRepo is an interface for a repository of Image.

type ImageRepoLog

type ImageRepoLog struct {
}

func NewImageRepoLog

func NewImageRepoLog() *ImageRepoLog

func (*ImageRepoLog) Get

func (p *ImageRepoLog) Get(ctx context.Context, reqImg Image) (Image, error)

func (*ImageRepoLog) Put

func (p *ImageRepoLog) Put(ctx context.Context, img Image) error

type Picture

type Picture interface {
	ID() string         // UUID of this picture info
	URL() string        // "http://www.example.com/image800x600.jpg"
	Resolution() string // original resolution of the picture in pixels, e.g. "1024x768", "640x480"

	Image() Image // Parent image for this picture info
	SetImage(img Image) error
}

Picture is an interface for a picture information.

type PictureJSON

type PictureJSON struct {
	ID         string `json:"id"`
	URL        string `json:"url"`
	Resolution string `json:"resolution"`
	ImageID    string `json:"imageId"`
}

Jump to

Keyboard shortcuts

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