action

package
v0.0.0-...-42b7ae8 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Output io.Writer
}

Action ...

func (Action) WriteString

func (a Action) WriteString(s string) (n int, err error)

WriteString takes string and prints it to the Output

type Context

type Context struct {
	Args  []string
	Flags map[string]string
}

Context makes easier to pass args and flags around

type Execute

type Execute func(Context) error

Execute is a type func that takes Context as parameter and returns an error

type Job

type Job struct {
	Action
	Service JobService
}

Job is a Action for Jobs

func NewJob

func NewJob(output io.Writer, jobService JobService) Job

NewJob constructs a Job

func (Job) Add

func (j Job) Add(c Context) error

Add creates a new job to the output

func (Job) List

func (j Job) List(c Context) error

List lists all jobs to the output

type JobService

type JobService interface {
	Add(job models.Job) (models.Job, error)
	Update(job models.Job) (models.Job, error)
	Find(id int) (models.Job, error)
	Delete(id int) (models.Job, error)
	All() ([]models.Job, error)
}

JobService defines required functions

Jump to

Keyboard shortcuts

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