package db import ( "github.com/jmoiron/sqlx" ) type Package struct { Db *sqlx.DB } type Interface interface { GetPokemons() ([]Pokemon, error) } type Pokemon struct { ID int `db:"id"` DexNumber int `db:"dex_number"` Region string `db:"region"` Name string `db:"name"` ShinyEnabled bool `db:"shiny_enabled"` ShinyImageName string `db:"shiny_image_name"` ImageName string `db:"image_name"` } func (p *Package) GetPokemons() ([]Pokemon, error) { var pokemons []Pokemon err := p.Db.Select(&pokemons, "SELECT * FROM pokemon") return pokemons, err }