photo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound   = errors.New("id does not exists")
	ErrCannotRead = errors.New("photo can't read")
)

Functions

This section is empty.

Types

type Identifier

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

func IdentifierOf

func IdentifierOf(value string) *Identifier

func NewIdentifier

func NewIdentifier(data []byte) *Identifier

func (*Identifier) Value

func (id *Identifier) Value() string
Example
id := IdentifierOf("example_id")
fmt.Println(id.Value())
Output:

example_id

type Photo

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

func New

func New(data []byte) *Photo

func Of

func Of(id Identifier, data []byte) *Photo

func (*Photo) ID

func (photo *Photo) ID() Identifier

func (*Photo) Image

func (photo *Photo) Image() []byte

func (*Photo) IsNew

func (photo *Photo) IsNew() bool

type Repository

type Repository interface {
	Save(photo Photo) (*Identifier, error)

	Read(id Identifier) (*Photo, error)

	Delete(id Identifier) error
}

type ResourceError

type ResourceError struct {
	ID  Identifier
	Err error
}

func (*ResourceError) Error

func (err *ResourceError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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