Chore: project init

This commit is contained in:
2026-02-24 13:18:43 +09:00
commit 3345549051
23 changed files with 788 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package download
import "gorm.io/gorm"
type Repository struct {
db *gorm.DB
}
func NewRepository(db *gorm.DB) *Repository {
return &Repository{db: db}
}
func (r *Repository) GetLatest() (*Info, error) {
var info Info
err := r.db.Last(&info).Error
return &info, err
}
func (r *Repository) Save(info *Info) error {
if info.ID == 0 {
return r.db.Create(info).Error
}
return r.db.Save(info).Error
}