todoappserver

package module
v0.0.0-...-105d69d Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 4 Imported by: 0

README

Todo Application (Server)

Useful commands

$ docker pull postgres
$ docker run --name=todo-db -e POSTGRES_PASSWORD='qwerty' -p 5432:5432 -d --rm postgres
$ docker ps
$ migrate create -ext sql -dir ./schema -seq init
$ migrate -path ./schema -database 'postgres://postgres:qwerty@localhost:5432/postgres?sslmode=disable' up
$ docker exec -it <CONTAINER_ID> /bin/bash
root@<CONTAINER_ID>:/# psql -U postgres
postgres=# \d
postgres=# select * from users;
postgres=# exit
root@<CONTAINER_ID>:/# exit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListsItems

type ListsItems struct {
	Id     int
	ItemId int
	ListId int
}

type Server

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

func (*Server) Run

func (s *Server) Run(port string, handler http.Handler) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type TodoItem

type TodoItem struct {
	Id          int    `json:"id" db:"id"`
	Title       string `json:"title" db:"title" binding:"required"`
	Description string `json:"description" db:"description"`
	Done        bool   `json:"done" db:"done"`
}

type TodoList

type TodoList struct {
	Id          int    `json:"id" db:"id"`
	Title       string `json:"title" db:"title" binding:"required"`
	Description string `json:"description" db:"description"`
}

type UpdateItemInput

type UpdateItemInput struct {
	Title       *string `json:"title"`
	Description *string `json:"description"`
	Done        *bool   `json:"done"`
}

func (UpdateItemInput) Validate

func (i UpdateItemInput) Validate() error

type UpdateListInput

type UpdateListInput struct {
	Title       *string `json:"title"`
	Description *string `json:"description"`
}

func (UpdateListInput) Validate

func (i UpdateListInput) Validate() error

type User

type User struct {
	Id       int    `json:"-" db:"id"`
	Name     string `json:"name" binding:"required"`
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type UsersList

type UsersList struct {
	Id     int
	UserId int
	ListId int
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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