Merged in feature/textextract (pull request #108)
Start adding Textract + UUID changes * base * startclient * ts * short * tests
This commit is contained in:
@@ -8,7 +8,7 @@ package repository
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const addResult = `-- name: AddResult :one
|
||||
@@ -16,23 +16,23 @@ INSERT INTO results (queryId, value, textEntryId, queryVersion) VALUES ($1, $2,
|
||||
`
|
||||
|
||||
type AddResultParams struct {
|
||||
Queryid pgtype.UUID `db:"queryid"`
|
||||
Value string `db:"value"`
|
||||
Textentryid pgtype.UUID `db:"textentryid"`
|
||||
Queryversion int32 `db:"queryversion"`
|
||||
Queryid uuid.UUID `db:"queryid"`
|
||||
Value string `db:"value"`
|
||||
Textentryid uuid.UUID `db:"textentryid"`
|
||||
Queryversion int32 `db:"queryversion"`
|
||||
}
|
||||
|
||||
// AddResult
|
||||
//
|
||||
// INSERT INTO results (queryId, value, textEntryId, queryVersion) VALUES ($1, $2, $3, $4) returning id
|
||||
func (q *Queries) AddResult(ctx context.Context, arg *AddResultParams) (pgtype.UUID, error) {
|
||||
func (q *Queries) AddResult(ctx context.Context, arg *AddResultParams) (uuid.UUID, error) {
|
||||
row := q.db.QueryRow(ctx, addResult,
|
||||
arg.Queryid,
|
||||
arg.Value,
|
||||
arg.Textentryid,
|
||||
arg.Queryversion,
|
||||
)
|
||||
var id pgtype.UUID
|
||||
var id uuid.UUID
|
||||
err := row.Scan(&id)
|
||||
return id, err
|
||||
}
|
||||
@@ -42,8 +42,8 @@ INSERT INTO resultDependencies (resultId, requiredResultId) VALUES ($1, $2)
|
||||
`
|
||||
|
||||
type AddResultDependencyParams struct {
|
||||
Resultid pgtype.UUID `db:"resultid"`
|
||||
Requiredresultid pgtype.UUID `db:"requiredresultid"`
|
||||
Resultid uuid.UUID `db:"resultid"`
|
||||
Requiredresultid uuid.UUID `db:"requiredresultid"`
|
||||
}
|
||||
|
||||
// AddResultDependency
|
||||
@@ -70,14 +70,14 @@ SELECT r.id, r.value
|
||||
`
|
||||
|
||||
type GetResultValueWithVersionParams struct {
|
||||
Queryid pgtype.UUID `db:"queryid"`
|
||||
Queryversion *int32 `db:"queryversion"`
|
||||
Documentid pgtype.UUID `db:"documentid"`
|
||||
Queryid *uuid.UUID `db:"queryid"`
|
||||
Queryversion *int32 `db:"queryversion"`
|
||||
Documentid *uuid.UUID `db:"documentid"`
|
||||
}
|
||||
|
||||
type GetResultValueWithVersionRow struct {
|
||||
ID pgtype.UUID `db:"id"`
|
||||
Value *string `db:"value"`
|
||||
ID *uuid.UUID `db:"id"`
|
||||
Value *string `db:"value"`
|
||||
}
|
||||
|
||||
// GetResultValueWithVersion
|
||||
@@ -148,16 +148,16 @@ WHERE rowNumber = 1
|
||||
`
|
||||
|
||||
type ListQueryRequirementValuesParams struct {
|
||||
Queryid pgtype.UUID `db:"queryid"`
|
||||
Version *int32 `db:"version"`
|
||||
Documentid pgtype.UUID `db:"documentid"`
|
||||
Queryid *uuid.UUID `db:"queryid"`
|
||||
Version *int32 `db:"version"`
|
||||
Documentid *uuid.UUID `db:"documentid"`
|
||||
}
|
||||
|
||||
type ListQueryRequirementValuesRow struct {
|
||||
ID pgtype.UUID `db:"id"`
|
||||
Queryid pgtype.UUID `db:"queryid"`
|
||||
Type Querytype `db:"type"`
|
||||
Value *string `db:"value"`
|
||||
ID *uuid.UUID `db:"id"`
|
||||
Queryid uuid.UUID `db:"queryid"`
|
||||
Type Querytype `db:"type"`
|
||||
Value *string `db:"value"`
|
||||
}
|
||||
|
||||
// ListQueryRequirementValues
|
||||
@@ -271,15 +271,15 @@ SELECT DISTINCT queryId FROM unsyncedQueries as baseuq
|
||||
// WHERE NOT EXISTS (
|
||||
// SELECT 1 FROM unsyncedQueries as uq WHERE uq.queryId = any(baseuq.requiredIds)
|
||||
// )
|
||||
func (q *Queries) ListUnsyncedNoDepsQueriesByDocId(ctx context.Context, dollar_1 pgtype.UUID) ([]pgtype.UUID, error) {
|
||||
func (q *Queries) ListUnsyncedNoDepsQueriesByDocId(ctx context.Context, dollar_1 *uuid.UUID) ([]*uuid.UUID, error) {
|
||||
rows, err := q.db.Query(ctx, listUnsyncedNoDepsQueriesByDocId, dollar_1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []pgtype.UUID{}
|
||||
items := []*uuid.UUID{}
|
||||
for rows.Next() {
|
||||
var queryid pgtype.UUID
|
||||
var queryid *uuid.UUID
|
||||
if err := rows.Scan(&queryid); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user