Discover Packages
github.com/VMironiuk/todo-app-server
package
module
Version:
v0.0.0-...-105d69d
Opens a new window with list of versions in this module.
Published: Nov 24, 2023
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
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
Expand ▾
Collapse ▴
Documentation
¶
type ListsItems struct {
Id int
ItemId int
ListId int
}
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 struct {
Id int `json:"id" db:"id"`
Title string `json:"title" db:"title" binding:"required"`
Description string `json:"description" db:"description"`
}
type UpdateItemInput struct {
Title *string `json:"title"`
Description *string `json:"description"`
Done *bool `json:"done"`
}
type UpdateListInput struct {
Title *string `json:"title"`
Description *string `json:"description"`
}
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 struct {
Id int
UserId int
ListId int
}
Source Files
¶
Directories
¶
pkg
Click to show internal directories.
Click to hide internal directories.