todoapp

package
v0.0.0-...-b7a354f Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package todostatus represents the status of a todo in the system.

Index

Constants

This section is empty.

Variables

View Source
var (
	Complete   = newStatus("COMPLETE")
	Incomplete = newStatus("INCOMPLETE")
)

The set of status types that can be used.

Functions

func RegisterRoutes

func RegisterRoutes(mux *http.ServeMux, dbService sqldb.Service) http.Handler

Types

type Decoder

type Decoder interface {
	Decode(data []byte) error
}

type Encoder

type Encoder interface {
	Encode() (data []byte, contentType string, err error)
}

type Status

type Status struct {
	// contains filtered or unexported fields
}

Status represents a status type in the system.

func MustParse

func MustParse(value string) Status

MustParse parses the string value and returns a status type if one exists. If an error occurs, the function panics.

func Parse

func Parse(value string) (Status, error)

Parse parses the string value and returns a status type if one exists.

func (Status) Equal

func (st Status) Equal(st2 Status) bool

Equal provides support for comparisons and testing.

func (Status) MarshalText

func (st Status) MarshalText() ([]byte, error)

MarshalText provides support for logging and any marshal needs.

func (Status) String

func (st Status) String() string

String returns the name of the status.

type Todo

type Todo struct {
	ID        int        `json:"id,omitempty"`
	Title     string     `json:"title" validate:"required, min=1,max=25" `
	Status    string     `json:"status" validate:"required"`
	ExpiredAt *time.Time `json:"expired_at,omitempty"`
	CreatedAt time.Time  `json:"created_at,omitempty"`
	UpdatedAt time.Time  `json:"updated_at,omitempty"`
}

func (*Todo) Decode

func (app *Todo) Decode(data []byte) error

Decode implements the decoder interface.

func (Todo) Encode

func (t Todo) Encode() ([]byte, string, error)

func (Todo) Validate

func (app Todo) Validate() error

type TodoRepository

type TodoRepository interface {
	// contains filtered or unexported methods
}

type Todos

type Todos []Todo

func (Todos) Encode

func (ts Todos) Encode() ([]byte, string, error)

Jump to

Keyboard shortcuts

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