sorarebuddy/db/zone.go
2024-05-23 08:18:54 +04:00

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: []"