services

package
v10.6.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Service Layer

The package which has access to call functions from the "repositories" and "models" ("datamodels" only in that simple example). It should contain the domain logic.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MovieService

type MovieService interface {
	GetAll() []datamodels.Movie
	GetByID(id int64) (datamodels.Movie, bool)
	DeleteByID(id int64) bool
	UpdatePosterAndGenreByID(id int64, poster string, genre string) (datamodels.Movie, error)
}

MovieService handles some of the CRUID operations of the movie datamodel. It depends on a movie repository for its actions. It's here to decouple the data source from the higher level compoments. As a result a different repository type can be used with the same logic without any aditional changes. It's an interface and it's used as interface everywhere because we may need to change or try an experimental different domain logic at the future.

func NewMovieService

func NewMovieService(repo repositories.MovieRepository) MovieService

NewMovieService returns the default movie service.

Jump to

Keyboard shortcuts

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