Merged in feature/textExtractionsPart3 (pull request #195)
enrich doc responses * enrich doc responses
This commit is contained in:
@@ -94,6 +94,52 @@ func (q *Queries) CreateDocument(ctx context.Context, arg *CreateDocumentParams)
|
||||
return id, err
|
||||
}
|
||||
|
||||
const getDocumentEnriched = `-- name: GetDocumentEnriched :one
|
||||
SELECT
|
||||
d.id,
|
||||
d.clientId,
|
||||
d.hash,
|
||||
d.folderId,
|
||||
d.filename,
|
||||
d.originalPath
|
||||
FROM documents d
|
||||
WHERE d.id = $1
|
||||
`
|
||||
|
||||
type GetDocumentEnrichedRow struct {
|
||||
ID uuid.UUID `db:"id"`
|
||||
Clientid string `db:"clientid"`
|
||||
Hash string `db:"hash"`
|
||||
Folderid *uuid.UUID `db:"folderid"`
|
||||
Filename *string `db:"filename"`
|
||||
Originalpath *string `db:"originalpath"`
|
||||
}
|
||||
|
||||
// Retrieves a document with extended metadata including folder and filename
|
||||
//
|
||||
// SELECT
|
||||
// d.id,
|
||||
// d.clientId,
|
||||
// d.hash,
|
||||
// d.folderId,
|
||||
// d.filename,
|
||||
// d.originalPath
|
||||
// FROM documents d
|
||||
// WHERE d.id = $1
|
||||
func (q *Queries) GetDocumentEnriched(ctx context.Context, id uuid.UUID) (*GetDocumentEnrichedRow, error) {
|
||||
row := q.db.QueryRow(ctx, getDocumentEnriched, id)
|
||||
var i GetDocumentEnrichedRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Clientid,
|
||||
&i.Hash,
|
||||
&i.Folderid,
|
||||
&i.Filename,
|
||||
&i.Originalpath,
|
||||
)
|
||||
return &i, err
|
||||
}
|
||||
|
||||
const getDocumentEntry = `-- name: GetDocumentEntry :one
|
||||
SELECT documentId, bucket, key FROM documentEntries WHERE documentId = $1 ORDER BY id DESC LIMIT 1
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user