proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package proxy implements the Proxy design pattern. ArtworkProxy is a lightweight stand-in for the real Artwork object. It implements the shared ArtDescriber interface and provides access to basic metadata such as title, author, year, and description. The proxy defers loading the heavy scan data until it is explicitly requested, delegating that responsibility to the underlying Artwork instance (lazy loading).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Types

type ArtDescriber

type ArtDescriber interface {
	Author() string
	Title() string
	Year() string
	Description() string
	LoadData() []byte
}

ArtDescriber defines the common interface for accessing artwork metadata and data, implemented by both Artwork and ArtworkProxy types.

type Artwork

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

Artwork is the original heavy data model that represents the painting.

func (*Artwork) Author

func (a *Artwork) Author() string

Author returns the name of the author.

func (*Artwork) Description

func (a *Artwork) Description() string

Description returns a short textual explanation of the artwork.

func (*Artwork) LoadData

func (a *Artwork) LoadData() []byte

LoadData reads the image data from filesystem and stores it into the internal data of the artwork.

func (*Artwork) String

func (a *Artwork) String() string

String returns the aggregated human readable metadata of the artwork.

func (*Artwork) Title

func (a *Artwork) Title() string

Title returns the commonly known name of the artwork.

func (*Artwork) Year

func (a *Artwork) Year() string

Year returns the year of creation.

type ArtworkProxy

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

ArtworkProxy is the lightweight proxy of the original Artwork.

func (*ArtworkProxy) Author

func (ap *ArtworkProxy) Author() string

Author returns the name of the author.

func (*ArtworkProxy) Description

func (ap *ArtworkProxy) Description() string

Description returns a short textual explanation of the artwork.

func (*ArtworkProxy) LoadData

func (ap *ArtworkProxy) LoadData() []byte

LoadData delegates the heavy data loading process to the original artwork.

func (*ArtworkProxy) String

func (ap *ArtworkProxy) String() string

String returns the aggregated human readable metadata of the artwork.

func (*ArtworkProxy) Title

func (ap *ArtworkProxy) Title() string

Title returns the commonly known name of the artwork.

func (*ArtworkProxy) Year

func (ap *ArtworkProxy) Year() string

Year returns the year of creation.

Jump to

Keyboard shortcuts

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