90353d8161
Doc Clean Structure * outline * isdocclean * placeholder for clean log * versionplustesting * versionplustesting * testspassed
103 lines
2.9 KiB
Go
103 lines
2.9 KiB
Go
// 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 addDocumentEntry = `-- name: AddDocumentEntry :exec
|
|
INSERT INTO documentEntries (documentId, bucket, key) VALUES ($1, $2, $3)
|
|
`
|
|
|
|
type AddDocumentEntryParams struct {
|
|
Documentid pgtype.UUID `db:"documentid"`
|
|
Bucket string `db:"bucket"`
|
|
Key string `db:"key"`
|
|
}
|
|
|
|
// AddDocumentEntry
|
|
//
|
|
// 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.Key)
|
|
return err
|
|
}
|
|
|
|
const createDocument = `-- name: CreateDocument :one
|
|
INSERT INTO documents (jobId, hash) VALUES ($1, $2) RETURNING id
|
|
`
|
|
|
|
type CreateDocumentParams struct {
|
|
Jobid pgtype.UUID `db:"jobid"`
|
|
Hash string `db:"hash"`
|
|
}
|
|
|
|
// CreateDocument
|
|
//
|
|
// INSERT INTO documents (jobId, hash) VALUES ($1, $2) RETURNING id
|
|
func (q *Queries) CreateDocument(ctx context.Context, arg *CreateDocumentParams) (pgtype.UUID, error) {
|
|
row := q.db.QueryRow(ctx, createDocument, arg.Jobid, arg.Hash)
|
|
var id pgtype.UUID
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|
|
|
|
const getDocument = `-- name: GetDocument :one
|
|
SELECT id, jobId, hash FROM documents WHERE id = $1 LIMIT 1
|
|
`
|
|
|
|
// GetDocument
|
|
//
|
|
// SELECT id, jobId, hash FROM documents WHERE id = $1 LIMIT 1
|
|
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)
|
|
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
|
|
`
|
|
|
|
type GetDocumentIDByHashParams struct {
|
|
Hash string `db:"hash"`
|
|
Jobid pgtype.UUID `db:"jobid"`
|
|
}
|
|
|
|
// GetDocumentIDByHash
|
|
//
|
|
// SELECT id FROM documents WHERE hash = $1 and jobId = $2
|
|
func (q *Queries) GetDocumentIDByHash(ctx context.Context, arg *GetDocumentIDByHashParams) (pgtype.UUID, error) {
|
|
row := q.db.QueryRow(ctx, getDocumentIDByHash, arg.Hash, arg.Jobid)
|
|
var id pgtype.UUID
|
|
err := row.Scan(&id)
|
|
return id, err
|
|
}
|