some fixes

This commit is contained in:
2026-01-20 10:06:37 +03:00
parent fec89b5305
commit 02437946ed
4 changed files with 45 additions and 8 deletions

View File

@@ -22,12 +22,12 @@ func NewFractionRepository(db *sqlx.DB) *FractionRepository {
return &FractionRepository{db: db}
}
func (rep *FractionRepository) GetAllFractions() ([]*Fraction, error) {
func (rep *FractionRepository) GetAll() ([]*Fraction, error) {
fractions := make([]*Fraction, 0)
err := rep.db.Select(&fractions, "SELECT * FROM fractions ORDER BY id DESC;")
return fractions, err
}
func (rep *FractionRepository) GetFraction(id int32) (*Fraction, error) {
func (rep *FractionRepository) GetById(id int32) (*Fraction, error) {
fraction := new(Fraction)
err := rep.db.Get(fraction, "SELECT * FROM fractions WHERE id = $1", id)
return fraction, err