Files
orbits/internal/database/functions.go
T
2026-04-20 16:58:20 +02:00

30 lines
482 B
Go

package database
import (
"path/filepath"
"gorm.io/gorm"
)
func GetAppState(db *gorm.DB) (AppState, error) {
var state AppState
return state, db.First(&state).Error
}
func GetFiles(db *gorm.DB) ([]Files, error) {
var files []Files
return files, db.Find(&files).Error
}
func RegisterFile(db *gorm.DB, category, fullPath string) error {
file := Files{
Mode: category,
Filename: filepath.Base(fullPath),
Filepath: fullPath,
}
return db.Create(&file).Error
}