sorarebuddy/db/zone.go

29 lines
578 B
Go
Raw Normal View History

2024-05-23 04:18:54 +00:00
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: []"