29 lines
578 B
Go
29 lines
578 B
Go
|
package db
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/uptrace/bun"
|
||
|
|
||
|
"git.lehouerou.net/laurent/sorarebuddy/model"
|
||
|
)
|
||
|
|
||
|
type ZoneRepository struct {
|
||
|
db *bun.DB
|
||
|
}
|
||
|
|
||
|
func NewZoneRepository(db *bun.DB) *ZoneRepository {
|
||
|
return &ZoneRepository{db: db}
|
||
|
}
|
||
|
|
||
|
func (r *ZoneRepository) GetAll(ctx context.Context) ([]model.Zone, error) {
|
||
|
var res []model.Zone
|
||
|
if err := r.db.NewSelect().Model(&res).Scan(ctx); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return res, nil
|
||
|
}
|
||
|
|
||
|
//initializing sorare client: getting current user: querying records: Message: Unauthorized: Signature has expired, Locations: []"
|