Merged in feature/docclean (pull request #55)
Doc Clean Structure * outline * isdocclean * placeholder for clean log * versionplustesting * versionplustesting * testspassed
This commit is contained in:
@@ -12,20 +12,20 @@ import (
|
||||
)
|
||||
|
||||
const addDocumentEntry = `-- name: AddDocumentEntry :exec
|
||||
INSERT INTO documentEntries (documentId, bucket, location) VALUES ($1, $2, $3)
|
||||
INSERT INTO documentEntries (documentId, bucket, key) VALUES ($1, $2, $3)
|
||||
`
|
||||
|
||||
type AddDocumentEntryParams struct {
|
||||
Documentid pgtype.UUID `db:"documentid"`
|
||||
Bucket string `db:"bucket"`
|
||||
Location string `db:"location"`
|
||||
Key string `db:"key"`
|
||||
}
|
||||
|
||||
// AddDocumentEntry
|
||||
//
|
||||
// INSERT INTO documentEntries (documentId, bucket, location) VALUES ($1, $2, $3)
|
||||
// INSERT INTO documentEntries (documentId, bucket, key) VALUES ($1, $2, $3)
|
||||
func (q *Queries) AddDocumentEntry(ctx context.Context, arg *AddDocumentEntryParams) error {
|
||||
_, err := q.db.Exec(ctx, addDocumentEntry, arg.Documentid, arg.Bucket, arg.Location)
|
||||
_, err := q.db.Exec(ctx, addDocumentEntry, arg.Documentid, arg.Bucket, arg.Key)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -62,6 +62,26 @@ func (q *Queries) GetDocument(ctx context.Context, id pgtype.UUID) (*Document, e
|
||||
return &i, err
|
||||
}
|
||||
|
||||
const getDocumentEntry = `-- name: GetDocumentEntry :one
|
||||
SELECT documentId, bucket, key FROM documentEntries WHERE documentId = $1 ORDER BY id DESC LIMIT 1
|
||||
`
|
||||
|
||||
type GetDocumentEntryRow struct {
|
||||
Documentid pgtype.UUID `db:"documentid"`
|
||||
Bucket string `db:"bucket"`
|
||||
Key string `db:"key"`
|
||||
}
|
||||
|
||||
// GetDocumentEntry
|
||||
//
|
||||
// SELECT documentId, bucket, key FROM documentEntries WHERE documentId = $1 ORDER BY id DESC LIMIT 1
|
||||
func (q *Queries) GetDocumentEntry(ctx context.Context, documentid pgtype.UUID) (*GetDocumentEntryRow, error) {
|
||||
row := q.db.QueryRow(ctx, getDocumentEntry, documentid)
|
||||
var i GetDocumentEntryRow
|
||||
err := row.Scan(&i.Documentid, &i.Bucket, &i.Key)
|
||||
return &i, err
|
||||
}
|
||||
|
||||
const getDocumentIDByHash = `-- name: GetDocumentIDByHash :one
|
||||
SELECT id FROM documents WHERE hash = $1 and jobId = $2
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user