Documentation
¶
Index ¶
- func ConnectToDatabase(databaseURL string, databaseName string) (*pgxpool.Pool, error)
- func CreateConnPool(databaseURL string) (*pgxpool.Pool, error)
- func CreateDatabaseIfNotExists(dbpool *pgxpool.Pool, dbname string) error
- func CreatePokemon(dbpool *pgxpool.Pool, tablename string, pokemon *models.Pokemon) error
- func CreatePokemonTable(dbpool *pgxpool.Pool, tablename string) error
- func DeletePokemon(dbpool *pgxpool.Pool, tablename string, name string) error
- func GetPokemon(dbpool *pgxpool.Pool, tablename string, name string) (*models.Pokemon, error)
- func GetPokemons(dbpool *pgxpool.Pool, tablename string) ([]models.Pokemon, error)
- func InitDatabase(config *models.AppConfig) (*pgxpool.Pool, error)
- func UpdatePokemon(dbpool *pgxpool.Pool, tablename string, pokemon *models.Pokemon) error
- func UpdatePokemonbyID(dbpool *pgxpool.Pool, tablename string, id int, pokemon *models.Pokemon) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToDatabase ¶
func CreatePokemon ¶
CreatePokemon creates a new Pokémon record in the database
func CreatePokemonTable ¶
create the Pokemontable for usage in the database initialization here we define the Primary key, as well as unique values.
func DeletePokemon ¶
DeletePokemon deletes a Pokémon record from the database based on the provided name The Exec function is used, because there are no rows returned
func GetPokemon ¶
GetPokemon retrieves a Pokémon record from the database based on the provided ID
func GetPokemons ¶
GetPokemons returns a slice of Pokémon record from the database
func UpdatePokemon ¶
UpdatePokemon updates an existing Pokémon record in the database this uses the name to update, this is okay since its unique in the database.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.