This commit is contained in:
jay brown
2025-08-04 10:54:22 -07:00
parent 582e5b77c0
commit 56fb9b4ab6
20 changed files with 1026 additions and 28 deletions
+14 -7
View File
@@ -59,19 +59,20 @@ func (q *Queries) AddDocumentUpload(ctx context.Context, arg *AddDocumentUploadP
}
const createDocument = `-- name: CreateDocument :one
INSERT INTO documents (clientId, hash) VALUES ($1, $2) RETURNING id
INSERT INTO documents (clientId, hash, batch_id) VALUES ($1, $2, $3) RETURNING id
`
type CreateDocumentParams struct {
Clientid string `db:"clientid"`
Hash string `db:"hash"`
Clientid string `db:"clientid"`
Hash string `db:"hash"`
BatchID *uuid.UUID `db:"batch_id"`
}
// CreateDocument
//
// INSERT INTO documents (clientId, hash) VALUES ($1, $2) RETURNING id
// INSERT INTO documents (clientId, hash, batch_id) VALUES ($1, $2, $3) RETURNING id
func (q *Queries) CreateDocument(ctx context.Context, arg *CreateDocumentParams) (uuid.UUID, error) {
row := q.db.QueryRow(ctx, createDocument, arg.Clientid, arg.Hash)
row := q.db.QueryRow(ctx, createDocument, arg.Clientid, arg.Hash, arg.BatchID)
var id uuid.UUID
err := row.Scan(&id)
return id, err
@@ -192,12 +193,18 @@ const getDocumentSummary = `-- name: GetDocumentSummary :one
SELECT id, clientId, hash FROM documents WHERE id = $1
`
type GetDocumentSummaryRow struct {
ID uuid.UUID `db:"id"`
Clientid string `db:"clientid"`
Hash string `db:"hash"`
}
// GetDocumentSummary
//
// SELECT id, clientId, hash FROM documents WHERE id = $1
func (q *Queries) GetDocumentSummary(ctx context.Context, id uuid.UUID) (*Document, error) {
func (q *Queries) GetDocumentSummary(ctx context.Context, id uuid.UUID) (*GetDocumentSummaryRow, error) {
row := q.db.QueryRow(ctx, getDocumentSummary, id)
var i Document
var i GetDocumentSummaryRow
err := row.Scan(&i.ID, &i.Clientid, &i.Hash)
return &i, err
}