16 lines
292 B
Go
16 lines
292 B
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
"maot-shortner/internal/domain"
|
|
)
|
|
|
|
func (db *Database) GetLinks(ctx context.Context) ([]*domain.Link, error) {
|
|
links := make([]*domain.Link, 0)
|
|
|
|
if err := db.WithContext(ctx).Find(&links).Error; err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return links, nil
|
|
}
|