78 lines
1.7 KiB
Go
78 lines
1.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: pending_uploads.sql
|
|
|
|
package sqlgen
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const deletePendingUpload = `-- name: DeletePendingUpload :exec
|
|
DELETE FROM pending_uploads WHERE guid = ?
|
|
`
|
|
|
|
func (q *Queries) DeletePendingUpload(ctx context.Context, guid string) error {
|
|
_, err := q.db.ExecContext(ctx, deletePendingUpload, guid)
|
|
return err
|
|
}
|
|
|
|
const insertPendingUpload = `-- name: InsertPendingUpload :one
|
|
INSERT INTO pending_uploads (
|
|
site_id,
|
|
guid,
|
|
user_id,
|
|
filename,
|
|
file_size,
|
|
mime_type,
|
|
upload_started_at
|
|
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
RETURNING id
|
|
`
|
|
|
|
type InsertPendingUploadParams struct {
|
|
SiteID int64
|
|
Guid string
|
|
UserID int64
|
|
Filename string
|
|
FileSize int64
|
|
MimeType string
|
|
UploadStartedAt int64
|
|
}
|
|
|
|
func (q *Queries) InsertPendingUpload(ctx context.Context, arg InsertPendingUploadParams) (interface{}, error) {
|
|
row := q.db.QueryRowContext(ctx, insertPendingUpload,
|
|
arg.SiteID,
|
|
arg.Guid,
|
|
arg.UserID,
|
|
arg.Filename,
|
|
arg.FileSize,
|
|
arg.MimeType,
|
|
arg.UploadStartedAt,
|
|
)
|
|
var id interface{}
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const selectPendingUploadByGUID = `-- name: SelectPendingUploadByGUID :one
|
|
SELECT id, site_id, guid, user_id, filename, file_size, mime_type, upload_started_at FROM pending_uploads WHERE guid = ? LIMIT 1
|
|
`
|
|
|
|
func (q *Queries) SelectPendingUploadByGUID(ctx context.Context, guid string) (PendingUpload, error) {
|
|
row := q.db.QueryRowContext(ctx, selectPendingUploadByGUID, guid)
|
|
var i PendingUpload
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.SiteID,
|
|
&i.Guid,
|
|
&i.UserID,
|
|
&i.Filename,
|
|
&i.FileSize,
|
|
&i.MimeType,
|
|
&i.UploadStartedAt,
|
|
)
|
|
return i, err
|
|
}
|