initial commit
This commit is contained in:
parent
9baa0fab25
commit
fc46164556
14 changed files with 243 additions and 0 deletions
16
internal/database/link.go
Normal file
16
internal/database/link.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue