Files
query-orchestration/internal/database/repository/document.sql.go
T

52 lines
1.2 KiB
Go
Raw Normal View History

2025-01-23 14:56:20 +00:00
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: document.sql
package repository
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const createDocument = `-- name: CreateDocument :one
INSERT INTO documents (jobId, hash, location) VALUES ($1, $2, $3) RETURNING id
2025-01-23 14:56:20 +00:00
`
type CreateDocumentParams struct {
Jobid pgtype.UUID `db:"jobid"`
Hash string `db:"hash"`
Location string `db:"location"`
}
2025-01-23 14:56:20 +00:00
// CreateDocument
//
// INSERT INTO documents (jobId, hash, location) VALUES ($1, $2, $3) RETURNING id
func (q *Queries) CreateDocument(ctx context.Context, arg *CreateDocumentParams) (pgtype.UUID, error) {
row := q.db.QueryRow(ctx, createDocument, arg.Jobid, arg.Hash, arg.Location)
2025-01-23 14:56:20 +00:00
var id pgtype.UUID
err := row.Scan(&id)
return id, err
}
const getDocument = `-- name: GetDocument :one
SELECT id, jobId, hash, location FROM documents WHERE id = $1 LIMIT 1
2025-01-23 14:56:20 +00:00
`
// GetDocument
//
// SELECT id, jobId, hash, location FROM documents WHERE id = $1 LIMIT 1
2025-01-23 14:56:20 +00:00
func (q *Queries) GetDocument(ctx context.Context, id pgtype.UUID) (*Document, error) {
row := q.db.QueryRow(ctx, getDocument, id)
var i Document
err := row.Scan(
&i.ID,
&i.Jobid,
&i.Hash,
&i.Location,
)
2025-01-23 14:56:20 +00:00
return &i, err
}