2020-07-05 01:02:57 +02:00
|
|
|
package db
|
|
|
|
|
2022-05-06 23:41:52 +02:00
|
|
|
import "database/sql"
|
2020-07-05 01:02:57 +02:00
|
|
|
|
2020-08-21 01:11:24 +02:00
|
|
|
// Repository contains methods for interacting with a database storage
|
2020-07-05 01:02:57 +02:00
|
|
|
type Repository struct {
|
|
|
|
*Queries
|
2022-05-06 23:41:52 +02:00
|
|
|
db *sql.DB
|
2020-07-05 01:02:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewRepository returns an implementation of the Repository interface.
|
2022-05-06 23:41:52 +02:00
|
|
|
func NewRepository(db *sql.DB) *Repository {
|
2020-07-05 01:02:57 +02:00
|
|
|
return &Repository{
|
2022-05-06 23:41:52 +02:00
|
|
|
Queries: New(db),
|
2020-07-05 01:02:57 +02:00
|
|
|
db: db,
|
|
|
|
}
|
|
|
|
}
|