go_scratch_prod

package module
v0.0.0-...-842b49f Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotImplemented indicates a missing feature from the application
	ErrNotImplemented = errors.New("feature not implemented")

	// ErrEntityNotFound indicates a specific entity could not be found
	ErrEntityNotFound = errors.New("entity not found")

	// ErrInvalidRequest means a request is either nil or not appropriate for the requested action
	ErrInvalidRequest = errors.New("request is invalid")
)

Functions

This section is empty.

Types

type Task

type Task struct {
	gorm.Model  `json:"-"`
	ID          string    `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	IsDone      bool      `json:"is_done"`
	CreatedAt   time.Time `json:"created_at"`
}

Task that needs to be accomplished

func (Task) String

func (t Task) String() string

type TaskHttpService

type TaskHttpService interface {
	Create(w http.ResponseWriter, r *http.Request)
	Update(w http.ResponseWriter, r *http.Request)
	MarkDone(w http.ResponseWriter, r *http.Request)
	MarkPending(w http.ResponseWriter, r *http.Request)
	List(w http.ResponseWriter, r *http.Request)
	ListDone(w http.ResponseWriter, r *http.Request)
	ListPending(w http.ResponseWriter, r *http.Request)
}

TaskHttpService exposes TaskService over an http interface

type TaskRepo

type TaskRepo interface {
	Create(ctx context.Context, task Task) error
	Get(ctx context.Context, id string) (*Task, error)
	List(ctx context.Context) ([]Task, error)
	Update(ctx context.Context, task Task) error
}

TaskRepo allows persistence of tasks

type TaskService

type TaskService interface {
	Create(ctx context.Context, t Task) (*Task, error)
	Update(ctx context.Context, task Task) error
	MarkDone(ctx context.Context, id string) error
	MarkPending(ctx context.Context, id string) error
	List(ctx context.Context) ([]Task, error)
	ListDone(ctx context.Context) ([]Task, error)
	ListPending(ctx context.Context) ([]Task, error)
}

TaskService exposes features of the application

Directories

Path Synopsis
cmd
gorm
sql
test
web

Jump to

Keyboard shortcuts

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