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 ¶
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) Description ¶
Description returns a short textual explanation of the artwork.
func (*Artwork) LoadData ¶
LoadData reads the image data from filesystem and stores it into the internal data of the artwork.
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.