# README
Database Support
Using SQLite3
Database can be generated following the next commands:
cd {project_root}
sqlite3 {db_name} < ./resources/pokemon.sql
Using PostgreSQL
The source file is located at {project_root}/resources/pokemon.sql
there is a docker compose file which can be used to start a database instance:
cd {project_root}/resources
docker-compose up -d
Interesting packages:
- database/sql This is the standard library in go
- jmoiron/sqlx Extension of the Go database/sql library
- Masterminds/squirrel SQL Generator
- gocraft/dbr Midway between Standard Library and ORM builds on top of sqlx and squirrel
- gorm.io/gorm Fully fledged ORM database support
# Functions
UsePostgreSQL overwrites the db module DB var with a pg implementation.
UseSQLite3 overwrites the db module DB var with an SQLite3 implementation.
# Variables
DS Is the pokemon Datasource.
# Structs
PostgreSQL is a datasource type for pg connection.
SQLite3 is a datasource type for sqlite3 connection.