store

package
v0.0.0-...-4a0eee0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoResults = fmt.Errorf("no results returned")

ErrNoResults is a generic error of sql.ErrNoRows

Functions

This section is empty.

Types

type ErrNotFound

type ErrNotFound error

ErrNotFound is returned when a todo is not found.

type Service

type Service interface {
	CreateTodo(todo *Todo) error
	GetTodos() ([]Todo, error)
	GetTodo(id int64) (Todo, error)
	UpdateTodo(todo Todo) error
	DeleteTodo(id int64) error
	Close() error
}

Service provides methods for interacting with a store

func NewPostgres

func NewPostgres(dsn string) (Service, error)

NewPostgres returns a new postgresql store from the given postgres-specific data source name.

type Todo

type Todo struct {
	ID          int64  `json:"id" db:"id"`
	Description string `json:"description" db:"description"`
	IsCompleted bool   `json:"isCompleted" db:"is_completed"`
}

Todo holds information about a Todo

Jump to

Keyboard shortcuts

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