project

package
v0.0.0-...-0bb9bcb Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHandler

func MakeHandler(ps Service, logger log.Logger) http.Handler

Types

type Project

type Project struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Status    Status    `json:"status"`
}

Project the representation of model Project

type Repository

type Repository interface {
	FindAll() ([]*Project, error)
	FindByName(name string) (Project, error)
	FindByID(ID string) (Project, error)
	Persist(project *Project) error
	Remove(ID string) error
}

Repository provides access a Project store.

type Service

type Service interface {
	// CreateProject this function creates a new project based on the name passed by parameter
	CreateProject(name string) (Project, error)

	// ModifyProjectName First of all searching into a repository if there any project with the name to change
	// if is not, search by ID the project and when found it then change the name and Persists the changes
	ModifyProjectName(ID string, newName string) (Project, error)

	// DeactivateProject First look for a project by its ID, if it finds it then it deactivates it
	DeactivateProject(ID string) error

	// ActivateProject First look for a project by its ID, if it finds it then it activates it
	ActivateProject(ID string) error

	// RemoveProject Remove a project from the face of the earth
	RemoveProject(ID string) error

	// FindProjects Fetch all projects on store
	FindProjects() ([]*Project, error)
}

Service the interface used for encapsulate the business logic of the project

func NewService

func NewService(repository Repository) Service

NewService Initialize the service Project

type Status

type Status int

Status define the states in which our project can be found

const (
	// StatusDisabled Representation of disabled status
	StatusDisabled Status = iota
	// StatusEnabled Representation of enabled status
	StatusEnabled
)

Jump to

Keyboard shortcuts

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