added more functions to db abstraction
This commit is contained in:
parent
b6265586e2
commit
197c6041d9
3 changed files with 21 additions and 0 deletions
|
@ -70,3 +70,13 @@ func GetFileMime(fileID pgtype.UUID) (string, error) {
|
|||
}
|
||||
return mimeType, nil
|
||||
}
|
||||
|
||||
func GetFileProperties(fileID pgtype.UUID) (sqlc.FileProperty, error) {
|
||||
query := sqlc.New(pool)
|
||||
fileProperties, err := query.GetFileProperties(context.Background(), fileID)
|
||||
if err != nil {
|
||||
slog.Error("Error in GetFileProperties", "file-uuid", fileID, "error", err)
|
||||
}
|
||||
return fileProperties, err
|
||||
|
||||
}
|
||||
|
|
|
@ -70,3 +70,12 @@ func AddProcessingJobMessage(jobid int64, message string) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func ALlProcessingJobs() ([]sqlc.ProcessingJob, error) {
|
||||
query := sqlc.New(pool)
|
||||
jobs, err := query.GetAllJobs(context.Background())
|
||||
if err != nil {
|
||||
slog.Error("Unable to retrieve processing jobs", "error", err)
|
||||
}
|
||||
return jobs, err
|
||||
}
|
||||
|
|
|
@ -32,3 +32,5 @@ SET completed = NOW(),
|
|||
error = $1
|
||||
WHERE id = $2;
|
||||
|
||||
-- name: GetAllJobs :many
|
||||
SELECT * FROM processing_jobs;
|
||||
|
|
Loading…
Add table
Reference in a new issue