Newer
Older
pokemon-go-trade / internal / db / db.go
package db

import (
	"github.com/jmoiron/sqlx"
)

type Package struct {
	Db *sqlx.DB
}

type Interface interface {
	GetPokemons() ([]Pokemon, error)
}

type Pokemon struct {
	ID               int
	Name             string
	DefaultImageName string
	ShinyImageName   string
	ImageName        string
}

func (p *Package) GetPokemons() ([]Pokemon, error) {
	var pokemons []Pokemon
	err := p.Db.Select(&pokemons, "SELECT * FROM pokemon")
	return pokemons, err
}