This is a toy
CLI application that shows the libraries and patterns used by Textile's Engineering team.
make build
Add the postgres-uri
connection string to the config file ~/.toy/config
.
For testing purposes you can use the string postgres://toy:toy@localhost/postgres?sslmode=disable&timezone=UTC
to connect to the Postgres docker container provided by make run-postgres
.
./toy person
Usage:
toy person [command]
Available Commands:
encode encode receives the person info and encodes using ProtoBuffer
list list lists all persons info in the database
store store stores the person info in the database
Flags:
-h, --help help for person
Global Flags:
--log-debug Enable debug level log
--log-json Enable structured logging
Use "toy person [command] --help" for more information about a command.
Encode the information of a person
./toy person encode --id 1 --name Bruno
0a054272756e6f1001
Stores the information of a person in a database
./toy person store --id 2 --name Jose --email jose@gmail.com
Lits all people stored in the database
.toy person list
ID: 2, Name: Jose, Email: jose@gmail.com
- How
cobra
andviper
is used- The use of command and sub command
- The use of flags and persistent flags
- The use of required flags
- The use of the
cli
helper built by Textile
- How
ProtoBuffer
is used throughbuf
- The use of
Makefile
- The use of
sqlc
- The use of
GitHub Actions
make protos
make sql-assets