entry

package
v0.0.0-...-7e7559a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

type HTTPServer struct {
	Service *Service
}

func NewHTTPServer

func NewHTTPServer(svc *Service) *HTTPServer

func (*HTTPServer) RouteTo

func (h *HTTPServer) RouteTo(e *echo.Echo, auth echo.MiddlewareFunc)

type Model

type Model struct {
	ID        int        `json:"id" db:"id"`
	UUID      uuid.UUID  `json:"uuid" db:"uuid"`
	Date      string     `json:"date" db:"date"`
	Mood      int        `json:"mood" db:"mood"`
	Sleep     int        `json:"sleep" db:"sleep"`
	Stress    int        `json:"stress" db:"stress"`
	Notes     *string    `json:"notes" db:"notes"`
	UpdatedAt time.Time  `json:"updated_at" db:"updated_at"`
	CreatedAt time.Time  `json:"created_at" db:"created_at"`
	DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
}

Model holds the basic data structure for an entry

type Service

type Service struct {
	DB *sqlx.DB
}

func NewService

func NewService(db *sqlx.DB) *Service

func (*Service) CreateEntry

func (es *Service) CreateEntry(entry *Model) (*Model, error)

func (*Service) GetEntry

func (es *Service) GetEntry(id int64) (*Model, error)

func (*Service) ListEntries

func (es *Service) ListEntries(limit int64) (*[]Model, error)

Jump to

Keyboard shortcuts

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