Merged in feature/jobsynced (pull request #72)
Job Status Get and DB tidy up * initalquery * tests * shorttests * testing queries * job * solvedthequery * updatingdb * fixingtests * repotests * shorttests * docker * testspassed
This commit is contained in:
@@ -43,15 +43,9 @@ func (q *Queries) CreateClient(ctx context.Context, name string) (pgtype.UUID, e
|
||||
}
|
||||
|
||||
const getClient = `-- name: GetClient :one
|
||||
SELECT c.id, c.name, coalesce(cs.canSync, false) as canSync
|
||||
SELECT c.id, c.name, cs.canSync
|
||||
FROM clients as c
|
||||
LEFT JOIN (
|
||||
SELECT clientId, canSync
|
||||
FROM clientCanSync
|
||||
WHERE clientId = $1
|
||||
ORDER BY id DESC
|
||||
LIMIT 1
|
||||
) as cs on cs.clientId = c.id
|
||||
JOIN currentClientCanSync as cs on cs.clientId = c.id
|
||||
WHERE c.id = $1
|
||||
`
|
||||
|
||||
@@ -63,18 +57,12 @@ type GetClientRow struct {
|
||||
|
||||
// GetClient
|
||||
//
|
||||
// SELECT c.id, c.name, coalesce(cs.canSync, false) as canSync
|
||||
// SELECT c.id, c.name, cs.canSync
|
||||
// FROM clients as c
|
||||
// LEFT JOIN (
|
||||
// SELECT clientId, canSync
|
||||
// FROM clientCanSync
|
||||
// WHERE clientId = $1
|
||||
// ORDER BY id DESC
|
||||
// LIMIT 1
|
||||
// ) as cs on cs.clientId = c.id
|
||||
// JOIN currentClientCanSync as cs on cs.clientId = c.id
|
||||
// WHERE c.id = $1
|
||||
func (q *Queries) GetClient(ctx context.Context, clientid pgtype.UUID) (*GetClientRow, error) {
|
||||
row := q.db.QueryRow(ctx, getClient, clientid)
|
||||
func (q *Queries) GetClient(ctx context.Context, id pgtype.UUID) (*GetClientRow, error) {
|
||||
row := q.db.QueryRow(ctx, getClient, id)
|
||||
var i GetClientRow
|
||||
err := row.Scan(&i.ID, &i.Name, &i.Cansync)
|
||||
return &i, err
|
||||
|
||||
Reference in New Issue
Block a user