storage

package
v0.0.0-...-6dea0d5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2018 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrHeroNotExist

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

ErrHeroNotExist custom error for Hero handlers it tells that requested hero is not existing

func NewErrHeroNotExist

func NewErrHeroNotExist(message string) *ErrHeroNotExist

NewErrHeroNotExist returns pointer with error message to ErrHeroNotExist

func (*ErrHeroNotExist) Error

func (e *ErrHeroNotExist) Error() string

type ErrNothingToDelete

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

ErrNothingToDelete custom error type for Hero handlers it tells that hero which requested to be deleted not exists

func NewErrNothingToDelete

func NewErrNothingToDelete(message string) *ErrNothingToDelete

NewErrNothingToDelete returns pointer with error message to ErrNothingToDelete

func (*ErrNothingToDelete) Error

func (e *ErrNothingToDelete) Error() string

type Hero

type Hero struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Hero contains hero data

func (*Hero) IsValid

func (h *Hero) IsValid() bool

IsValid validates hero structure

type Storager

type Storager interface {
	Status() (string, error)
	GetHeroes() ([]Hero, error)
	GetHero(name string) (Hero, error)
	CreateHero(id, name string) error
	DeleteHero(id string) error
}

Storager general storage interface

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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