add consistency to sqlc queries - quotations (#35)
This commit is contained in:
parent
b5f39995b2
commit
a07c91e9b9
@ -9,43 +9,43 @@ FOR NO KEY UPDATE;
|
|||||||
|
|
||||||
-- name: CreateAccount :one
|
-- name: CreateAccount :one
|
||||||
INSERT INTO accounts (
|
INSERT INTO accounts (
|
||||||
passwordhash,
|
"passwordhash",
|
||||||
firstname,
|
"firstname",
|
||||||
lastname,
|
"lastname",
|
||||||
birthday,
|
"birthday",
|
||||||
email,
|
"email",
|
||||||
phone,
|
"phone",
|
||||||
city,
|
"city",
|
||||||
zip,
|
"zip",
|
||||||
street,
|
"street",
|
||||||
country,
|
"country",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11
|
||||||
) RETURNING *;
|
) RETURNING *;
|
||||||
|
|
||||||
-- name: ListAccounts :many
|
-- name: ListAccounts :many
|
||||||
SELECT * FROM accounts
|
SELECT * FROM accounts
|
||||||
ORDER BY lastname, firstname
|
ORDER BY "lastname", "firstname"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2;
|
OFFSET $2;
|
||||||
|
|
||||||
-- name: UpdateAccount :one
|
-- name: UpdateAccount :one
|
||||||
UPDATE accounts
|
UPDATE accounts
|
||||||
SET
|
SET
|
||||||
passwordhash = COALESCE(sqlc.narg(passwordhash), passwordhash),
|
"passwordhash" = COALESCE(sqlc.narg(passwordhash), "passwordhash"),
|
||||||
firstname = COALESCE(sqlc.narg(firstname), firstname),
|
"firstname" = COALESCE(sqlc.narg(firstname), "firstname"),
|
||||||
lastname = COALESCE(sqlc.narg(lastname), lastname),
|
"lastname" = COALESCE(sqlc.narg(lastname), "lastname"),
|
||||||
birthday = COALESCE(sqlc.narg(birthday), birthday),
|
"birthday" = COALESCE(sqlc.narg(birthday), "birthday"),
|
||||||
email = COALESCE(sqlc.narg(email), email),
|
"email" = COALESCE(sqlc.narg(email), "email"),
|
||||||
phone = COALESCE(sqlc.narg(phone), phone),
|
"phone" = COALESCE(sqlc.narg(phone), "phone"),
|
||||||
city = COALESCE(sqlc.narg(city), city),
|
"city" = COALESCE(sqlc.narg(city), "city"),
|
||||||
zip = COALESCE(sqlc.narg(zip), zip),
|
"zip" = COALESCE(sqlc.narg(zip), "zip"),
|
||||||
street = COALESCE(sqlc.narg(street), street),
|
"street" = COALESCE(sqlc.narg(street), "street"),
|
||||||
country = COALESCE(sqlc.narg(country), country),
|
"country" = COALESCE(sqlc.narg(country), "country"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@ WHERE "ID" = $1 LIMIT 1;
|
|||||||
-- name: CreateDocumentUpload :one
|
-- name: CreateDocumentUpload :one
|
||||||
INSERT INTO documents (
|
INSERT INTO documents (
|
||||||
"personID",
|
"personID",
|
||||||
name,
|
"name",
|
||||||
type,
|
"type",
|
||||||
path,
|
"path",
|
||||||
url,
|
"url",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7
|
$1, $2, $3, $4, $5, $6, $7
|
||||||
) RETURNING *;
|
) RETURNING *;
|
||||||
@ -18,19 +18,19 @@ INSERT INTO documents (
|
|||||||
-- name: CreateDocumentMail :one
|
-- name: CreateDocumentMail :one
|
||||||
INSERT INTO documents (
|
INSERT INTO documents (
|
||||||
"mailID",
|
"mailID",
|
||||||
name,
|
"name",
|
||||||
type,
|
"type",
|
||||||
path,
|
"path",
|
||||||
url,
|
"url",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7
|
$1, $2, $3, $4, $5, $6, $7
|
||||||
) RETURNING *;
|
) RETURNING *;
|
||||||
|
|
||||||
-- name: ListDocuments :many
|
-- name: ListDocuments :many
|
||||||
SELECT * FROM documents
|
SELECT * FROM documents
|
||||||
ORDER BY valid, type, name
|
ORDER BY "valid", "type", "name"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2;
|
OFFSET $2;
|
||||||
|
|
||||||
@ -38,10 +38,10 @@ OFFSET $2;
|
|||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET
|
SET
|
||||||
"personID" = COALESCE(sqlc.narg(personID), "personID"),
|
"personID" = COALESCE(sqlc.narg(personID), "personID"),
|
||||||
name = COALESCE(sqlc.narg(name), name),
|
"name" = COALESCE(sqlc.narg(name), "name"),
|
||||||
type = COALESCE(sqlc.narg(type), type),
|
"type" = COALESCE(sqlc.narg(type), "type"),
|
||||||
path = COALESCE(sqlc.narg(path), path),
|
"path" = COALESCE(sqlc.narg(path), "path"),
|
||||||
url = COALESCE(sqlc.narg(url), url),
|
"url" = COALESCE(sqlc.narg(url), "url"),
|
||||||
changer = $2,
|
changer = $2,
|
||||||
changed = now()
|
changed = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
@ -50,22 +50,22 @@ RETURNING *;
|
|||||||
-- name: ValidateDocument :one
|
-- name: ValidateDocument :one
|
||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET
|
SET
|
||||||
valid = true,
|
"valid" = true,
|
||||||
"validDate" = now(),
|
"validDate" = now(),
|
||||||
"validatedBy" = $2,
|
"validatedBy" = $2,
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
-- name: InvalidateDocument :one
|
-- name: InvalidateDocument :one
|
||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET
|
SET
|
||||||
valid = false,
|
"valid" = false,
|
||||||
"validDate" = NULL,
|
"validDate" = NULL,
|
||||||
"validatedBy" = NULL,
|
"validatedBy" = NULL,
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -6,12 +6,12 @@ WHERE "ID" = $1 LIMIT 1;
|
|||||||
INSERT INTO mails (
|
INSERT INTO mails (
|
||||||
"from",
|
"from",
|
||||||
"to",
|
"to",
|
||||||
cc,
|
"cc",
|
||||||
"subject",
|
"subject",
|
||||||
body,
|
"body",
|
||||||
"timestamp",
|
"timestamp",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8
|
$1, $2, $3, $4, $5, $6, $7, $8
|
||||||
|
@ -6,15 +6,15 @@ WHERE "ID" = $1 LIMIT 1;
|
|||||||
INSERT INTO payments (
|
INSERT INTO payments (
|
||||||
"accountID",
|
"accountID",
|
||||||
"paymentCategory",
|
"paymentCategory",
|
||||||
bankname,
|
"bankname",
|
||||||
"IBAN",
|
"IBAN",
|
||||||
"BIC",
|
"BIC",
|
||||||
"paypalAccount",
|
"paypalAccount",
|
||||||
"paypalID",
|
"paypalID",
|
||||||
"paymentSystem",
|
"paymentSystem",
|
||||||
"type",
|
"type",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
|
||||||
) RETURNING *;
|
) RETURNING *;
|
||||||
@ -30,15 +30,15 @@ UPDATE payments
|
|||||||
SET
|
SET
|
||||||
"accountID" = COALESCE(sqlc.narg(accountID), "accountID"),
|
"accountID" = COALESCE(sqlc.narg(accountID), "accountID"),
|
||||||
"paymentCategory" = COALESCE(sqlc.narg(paymentCategory), "paymentCategory"),
|
"paymentCategory" = COALESCE(sqlc.narg(paymentCategory), "paymentCategory"),
|
||||||
bankname = COALESCE(sqlc.narg(bankname), bankname),
|
"bankname" = COALESCE(sqlc.narg(bankname), "bankname"),
|
||||||
"IBAN" = COALESCE(sqlc.narg(IBAN), "IBAN"),
|
"IBAN" = COALESCE(sqlc.narg(IBAN), "IBAN"),
|
||||||
"BIC" = COALESCE(sqlc.narg(BIC), "BIC"),
|
"BIC" = COALESCE(sqlc.narg(BIC), "BIC"),
|
||||||
"paypalAccount" = COALESCE(sqlc.narg(paypalAccount), "paypalAccount"),
|
"paypalAccount" = COALESCE(sqlc.narg(paypalAccount), "paypalAccount"),
|
||||||
"paypalID" = COALESCE(sqlc.narg(paypalID), "paypalID"),
|
"paypalID" = COALESCE(sqlc.narg(paypalID), "paypalID"),
|
||||||
"paymentSystem" = COALESCE(sqlc.narg(paymentSystem), "paymentSystem"),
|
"paymentSystem" = COALESCE(sqlc.narg(paymentSystem), "paymentSystem"),
|
||||||
"type" = COALESCE(sqlc.narg(type), "type"),
|
"type" = COALESCE(sqlc.narg(type), "type"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -5,22 +5,22 @@ WHERE "ID" = $1 LIMIT 1;
|
|||||||
-- name: CreatePerson :one
|
-- name: CreatePerson :one
|
||||||
INSERT INTO persons (
|
INSERT INTO persons (
|
||||||
"accountID",
|
"accountID",
|
||||||
firstname,
|
"firstname",
|
||||||
lastname,
|
"lastname",
|
||||||
birthday,
|
"birthday",
|
||||||
city,
|
"city",
|
||||||
zip,
|
"zip",
|
||||||
street,
|
"street",
|
||||||
country,
|
"country",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
||||||
) RETURNING *;
|
) RETURNING *;
|
||||||
|
|
||||||
-- name: ListPersons :many
|
-- name: ListPersons :many
|
||||||
SELECT * FROM persons
|
SELECT * FROM persons
|
||||||
ORDER BY lastname, firstname
|
ORDER BY "lastname", "firstname"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2;
|
OFFSET $2;
|
||||||
|
|
||||||
@ -28,15 +28,15 @@ OFFSET $2;
|
|||||||
UPDATE persons
|
UPDATE persons
|
||||||
SET
|
SET
|
||||||
"accountID" = COALESCE(sqlc.narg(accountID), "accountID"),
|
"accountID" = COALESCE(sqlc.narg(accountID), "accountID"),
|
||||||
firstname = COALESCE(sqlc.narg(firstname), firstname),
|
"firstname" = COALESCE(sqlc.narg(firstname), "firstname"),
|
||||||
lastname = COALESCE(sqlc.narg(lastname), lastname),
|
"lastname" = COALESCE(sqlc.narg(lastname), "lastname"),
|
||||||
birthday = COALESCE(sqlc.narg(birthday), birthday),
|
"birthday" = COALESCE(sqlc.narg(birthday), "birthday"),
|
||||||
city = COALESCE(sqlc.narg(city), city),
|
"city" = COALESCE(sqlc.narg(city), "city"),
|
||||||
zip = COALESCE(sqlc.narg(zip), zip),
|
"zip" = COALESCE(sqlc.narg(zip), "zip"),
|
||||||
street = COALESCE(sqlc.narg(street), street),
|
"street" = COALESCE(sqlc.narg(street), "street"),
|
||||||
country = COALESCE(sqlc.narg(country), country),
|
"country" = COALESCE(sqlc.narg(country), "country"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -4,31 +4,31 @@ WHERE "ID" = $1 LIMIT 1;
|
|||||||
|
|
||||||
-- name: CreateProvider :one
|
-- name: CreateProvider :one
|
||||||
INSERT INTO providers (
|
INSERT INTO providers (
|
||||||
name,
|
"name",
|
||||||
description,
|
"description",
|
||||||
category,
|
"category",
|
||||||
email,
|
"email",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6
|
$1, $2, $3, $4, $5, $6
|
||||||
) RETURNING *;
|
) RETURNING *;
|
||||||
|
|
||||||
-- name: ListProviders :many
|
-- name: ListProviders :many
|
||||||
SELECT * FROM providers
|
SELECT * FROM providers
|
||||||
ORDER BY name
|
ORDER BY "name"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2;
|
OFFSET $2;
|
||||||
|
|
||||||
-- name: UpdateProvider :one
|
-- name: UpdateProvider :one
|
||||||
UPDATE providers
|
UPDATE providers
|
||||||
SET
|
SET
|
||||||
name = COALESCE(sqlc.narg(name), name),
|
"name" = COALESCE(sqlc.narg(name), "name"),
|
||||||
description = COALESCE(sqlc.narg(description), description),
|
"description" = COALESCE(sqlc.narg(description), "description"),
|
||||||
category = COALESCE(sqlc.narg(category), category),
|
"category" = COALESCE(sqlc.narg(category), "category"),
|
||||||
email = COALESCE(sqlc.narg(email), email),
|
"email" = COALESCE(sqlc.narg(email), "email"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ INSERT INTO returns (
|
|||||||
|
|
||||||
-- name: ListReturns :many
|
-- name: ListReturns :many
|
||||||
SELECT * FROM returns
|
SELECT * FROM returns
|
||||||
ORDER BY name
|
ORDER BY "name"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2;
|
OFFSET $2;
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ SET
|
|||||||
"category" = COALESCE(sqlc.narg(category), "category"),
|
"category" = COALESCE(sqlc.narg(category), "category"),
|
||||||
"email" = COALESCE(sqlc.narg(email), "email"),
|
"email" = COALESCE(sqlc.narg(email), "email"),
|
||||||
"status" = COALESCE(sqlc.narg(status), "status"),
|
"status" = COALESCE(sqlc.narg(status), "status"),
|
||||||
changer = sqlc.arg(changer),
|
"changer" = sqlc.arg(changer),
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = sqlc.arg(ID)
|
WHERE "ID" = sqlc.arg(ID)
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ INSERT INTO "returnsLog" (
|
|||||||
|
|
||||||
-- name: ListReturnsLogs :many
|
-- name: ListReturnsLogs :many
|
||||||
SELECT * FROM "returnsLog"
|
SELECT * FROM "returnsLog"
|
||||||
ORDER BY status
|
ORDER BY "status"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2;
|
OFFSET $2;
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ SET
|
|||||||
"returnID" = COALESCE(sqlc.narg(returnID), "returnID"),
|
"returnID" = COALESCE(sqlc.narg(returnID), "returnID"),
|
||||||
"mailID" = COALESCE(sqlc.narg(mailID), "mailID"),
|
"mailID" = COALESCE(sqlc.narg(mailID), "mailID"),
|
||||||
"status" = COALESCE(sqlc.narg(status), "status"),
|
"status" = COALESCE(sqlc.narg(status), "status"),
|
||||||
changer = $1,
|
"changer" = $1,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = sqlc.arg(ID)
|
WHERE "ID" = sqlc.arg(ID)
|
||||||
RETURNING *;
|
RETURNING *;
|
||||||
|
|
||||||
|
@ -13,18 +13,18 @@ import (
|
|||||||
|
|
||||||
const createAccount = `-- name: CreateAccount :one
|
const createAccount = `-- name: CreateAccount :one
|
||||||
INSERT INTO accounts (
|
INSERT INTO accounts (
|
||||||
passwordhash,
|
"passwordhash",
|
||||||
firstname,
|
"firstname",
|
||||||
lastname,
|
"lastname",
|
||||||
birthday,
|
"birthday",
|
||||||
email,
|
"email",
|
||||||
phone,
|
"phone",
|
||||||
city,
|
"city",
|
||||||
zip,
|
"zip",
|
||||||
street,
|
"street",
|
||||||
country,
|
"country",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11
|
||||||
) RETURNING "ID", passwordhash, firstname, lastname, birthday, "privacyAccepted", "privacyAcceptedDate", email, phone, city, zip, street, country, token, "tokenValid", "tokenExpiration", creator, created, changer, changed
|
) RETURNING "ID", passwordhash, firstname, lastname, birthday, "privacyAccepted", "privacyAcceptedDate", email, phone, city, zip, street, country, token, "tokenValid", "tokenExpiration", creator, created, changer, changed
|
||||||
@ -163,7 +163,7 @@ func (q *Queries) GetAccountForUpdate(ctx context.Context, id int64) (Account, e
|
|||||||
|
|
||||||
const listAccounts = `-- name: ListAccounts :many
|
const listAccounts = `-- name: ListAccounts :many
|
||||||
SELECT "ID", passwordhash, firstname, lastname, birthday, "privacyAccepted", "privacyAcceptedDate", email, phone, city, zip, street, country, token, "tokenValid", "tokenExpiration", creator, created, changer, changed FROM accounts
|
SELECT "ID", passwordhash, firstname, lastname, birthday, "privacyAccepted", "privacyAcceptedDate", email, phone, city, zip, street, country, token, "tokenValid", "tokenExpiration", creator, created, changer, changed FROM accounts
|
||||||
ORDER BY lastname, firstname
|
ORDER BY "lastname", "firstname"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2
|
OFFSET $2
|
||||||
`
|
`
|
||||||
@ -220,18 +220,18 @@ func (q *Queries) ListAccounts(ctx context.Context, arg ListAccountsParams) ([]A
|
|||||||
const updateAccount = `-- name: UpdateAccount :one
|
const updateAccount = `-- name: UpdateAccount :one
|
||||||
UPDATE accounts
|
UPDATE accounts
|
||||||
SET
|
SET
|
||||||
passwordhash = COALESCE($3, passwordhash),
|
"passwordhash" = COALESCE($3, "passwordhash"),
|
||||||
firstname = COALESCE($4, firstname),
|
"firstname" = COALESCE($4, "firstname"),
|
||||||
lastname = COALESCE($5, lastname),
|
"lastname" = COALESCE($5, "lastname"),
|
||||||
birthday = COALESCE($6, birthday),
|
"birthday" = COALESCE($6, "birthday"),
|
||||||
email = COALESCE($7, email),
|
"email" = COALESCE($7, "email"),
|
||||||
phone = COALESCE($8, phone),
|
"phone" = COALESCE($8, "phone"),
|
||||||
city = COALESCE($9, city),
|
"city" = COALESCE($9, "city"),
|
||||||
zip = COALESCE($10, zip),
|
"zip" = COALESCE($10, "zip"),
|
||||||
street = COALESCE($11, street),
|
"street" = COALESCE($11, "street"),
|
||||||
country = COALESCE($12, country),
|
"country" = COALESCE($12, "country"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING "ID", passwordhash, firstname, lastname, birthday, "privacyAccepted", "privacyAcceptedDate", email, phone, city, zip, street, country, token, "tokenValid", "tokenExpiration", creator, created, changer, changed
|
RETURNING "ID", passwordhash, firstname, lastname, birthday, "privacyAccepted", "privacyAcceptedDate", email, phone, city, zip, street, country, token, "tokenValid", "tokenExpiration", creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
@ -13,12 +13,12 @@ import (
|
|||||||
const createDocumentMail = `-- name: CreateDocumentMail :one
|
const createDocumentMail = `-- name: CreateDocumentMail :one
|
||||||
INSERT INTO documents (
|
INSERT INTO documents (
|
||||||
"mailID",
|
"mailID",
|
||||||
name,
|
"name",
|
||||||
type,
|
"type",
|
||||||
path,
|
"path",
|
||||||
url,
|
"url",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7
|
$1, $2, $3, $4, $5, $6, $7
|
||||||
) RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
) RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
||||||
@ -67,12 +67,12 @@ func (q *Queries) CreateDocumentMail(ctx context.Context, arg CreateDocumentMail
|
|||||||
const createDocumentUpload = `-- name: CreateDocumentUpload :one
|
const createDocumentUpload = `-- name: CreateDocumentUpload :one
|
||||||
INSERT INTO documents (
|
INSERT INTO documents (
|
||||||
"personID",
|
"personID",
|
||||||
name,
|
"name",
|
||||||
type,
|
"type",
|
||||||
path,
|
"path",
|
||||||
url,
|
"url",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7
|
$1, $2, $3, $4, $5, $6, $7
|
||||||
) RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
) RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
||||||
@ -158,11 +158,11 @@ func (q *Queries) GetDocument(ctx context.Context, id int64) (Document, error) {
|
|||||||
const invalidateDocument = `-- name: InvalidateDocument :one
|
const invalidateDocument = `-- name: InvalidateDocument :one
|
||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET
|
SET
|
||||||
valid = false,
|
"valid" = false,
|
||||||
"validDate" = NULL,
|
"validDate" = NULL,
|
||||||
"validatedBy" = NULL,
|
"validatedBy" = NULL,
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
||||||
`
|
`
|
||||||
@ -196,7 +196,7 @@ func (q *Queries) InvalidateDocument(ctx context.Context, arg InvalidateDocument
|
|||||||
|
|
||||||
const listDocuments = `-- name: ListDocuments :many
|
const listDocuments = `-- name: ListDocuments :many
|
||||||
SELECT "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed FROM documents
|
SELECT "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed FROM documents
|
||||||
ORDER BY valid, type, name
|
ORDER BY "valid", "type", "name"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2
|
OFFSET $2
|
||||||
`
|
`
|
||||||
@ -248,10 +248,10 @@ const updateDocument = `-- name: UpdateDocument :one
|
|||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET
|
SET
|
||||||
"personID" = COALESCE($3, "personID"),
|
"personID" = COALESCE($3, "personID"),
|
||||||
name = COALESCE($4, name),
|
"name" = COALESCE($4, "name"),
|
||||||
type = COALESCE($5, type),
|
"type" = COALESCE($5, "type"),
|
||||||
path = COALESCE($6, path),
|
"path" = COALESCE($6, "path"),
|
||||||
url = COALESCE($7, url),
|
"url" = COALESCE($7, "url"),
|
||||||
changer = $2,
|
changer = $2,
|
||||||
changed = now()
|
changed = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
@ -301,11 +301,11 @@ func (q *Queries) UpdateDocument(ctx context.Context, arg UpdateDocumentParams)
|
|||||||
const validateDocument = `-- name: ValidateDocument :one
|
const validateDocument = `-- name: ValidateDocument :one
|
||||||
UPDATE documents
|
UPDATE documents
|
||||||
SET
|
SET
|
||||||
valid = true,
|
"valid" = true,
|
||||||
"validDate" = now(),
|
"validDate" = now(),
|
||||||
"validatedBy" = $2,
|
"validatedBy" = $2,
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
RETURNING "ID", "personID", name, type, path, url, valid, "validDate", "validatedBy", "mailID", creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
@ -16,12 +16,12 @@ const createMail = `-- name: CreateMail :one
|
|||||||
INSERT INTO mails (
|
INSERT INTO mails (
|
||||||
"from",
|
"from",
|
||||||
"to",
|
"to",
|
||||||
cc,
|
"cc",
|
||||||
"subject",
|
"subject",
|
||||||
body,
|
"body",
|
||||||
"timestamp",
|
"timestamp",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8
|
$1, $2, $3, $4, $5, $6, $7, $8
|
||||||
|
@ -14,15 +14,15 @@ const createPayment = `-- name: CreatePayment :one
|
|||||||
INSERT INTO payments (
|
INSERT INTO payments (
|
||||||
"accountID",
|
"accountID",
|
||||||
"paymentCategory",
|
"paymentCategory",
|
||||||
bankname,
|
"bankname",
|
||||||
"IBAN",
|
"IBAN",
|
||||||
"BIC",
|
"BIC",
|
||||||
"paypalAccount",
|
"paypalAccount",
|
||||||
"paypalID",
|
"paypalID",
|
||||||
"paymentSystem",
|
"paymentSystem",
|
||||||
"type",
|
"type",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
|
||||||
) RETURNING "ID", "accountID", "paymentCategory", bankname, "IBAN", "BIC", "paypalAccount", "paypalID", "paymentSystem", type, creator, created, changer, changed
|
) RETURNING "ID", "accountID", "paymentCategory", bankname, "IBAN", "BIC", "paypalAccount", "paypalID", "paymentSystem", type, creator, created, changer, changed
|
||||||
@ -168,15 +168,15 @@ UPDATE payments
|
|||||||
SET
|
SET
|
||||||
"accountID" = COALESCE($3, "accountID"),
|
"accountID" = COALESCE($3, "accountID"),
|
||||||
"paymentCategory" = COALESCE($4, "paymentCategory"),
|
"paymentCategory" = COALESCE($4, "paymentCategory"),
|
||||||
bankname = COALESCE($5, bankname),
|
"bankname" = COALESCE($5, "bankname"),
|
||||||
"IBAN" = COALESCE($6, "IBAN"),
|
"IBAN" = COALESCE($6, "IBAN"),
|
||||||
"BIC" = COALESCE($7, "BIC"),
|
"BIC" = COALESCE($7, "BIC"),
|
||||||
"paypalAccount" = COALESCE($8, "paypalAccount"),
|
"paypalAccount" = COALESCE($8, "paypalAccount"),
|
||||||
"paypalID" = COALESCE($9, "paypalID"),
|
"paypalID" = COALESCE($9, "paypalID"),
|
||||||
"paymentSystem" = COALESCE($10, "paymentSystem"),
|
"paymentSystem" = COALESCE($10, "paymentSystem"),
|
||||||
"type" = COALESCE($11, "type"),
|
"type" = COALESCE($11, "type"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING "ID", "accountID", "paymentCategory", bankname, "IBAN", "BIC", "paypalAccount", "paypalID", "paymentSystem", type, creator, created, changer, changed
|
RETURNING "ID", "accountID", "paymentCategory", bankname, "IBAN", "BIC", "paypalAccount", "paypalID", "paymentSystem", type, creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
@ -14,15 +14,15 @@ import (
|
|||||||
const createPerson = `-- name: CreatePerson :one
|
const createPerson = `-- name: CreatePerson :one
|
||||||
INSERT INTO persons (
|
INSERT INTO persons (
|
||||||
"accountID",
|
"accountID",
|
||||||
firstname,
|
"firstname",
|
||||||
lastname,
|
"lastname",
|
||||||
birthday,
|
"birthday",
|
||||||
city,
|
"city",
|
||||||
zip,
|
"zip",
|
||||||
street,
|
"street",
|
||||||
country,
|
"country",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
||||||
) RETURNING "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed
|
) RETURNING "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed
|
||||||
@ -111,7 +111,7 @@ func (q *Queries) GetPerson(ctx context.Context, id int64) (Person, error) {
|
|||||||
|
|
||||||
const listPersons = `-- name: ListPersons :many
|
const listPersons = `-- name: ListPersons :many
|
||||||
SELECT "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed FROM persons
|
SELECT "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed FROM persons
|
||||||
ORDER BY lastname, firstname
|
ORDER BY "lastname", "firstname"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2
|
OFFSET $2
|
||||||
`
|
`
|
||||||
@ -162,15 +162,15 @@ const updatePerson = `-- name: UpdatePerson :one
|
|||||||
UPDATE persons
|
UPDATE persons
|
||||||
SET
|
SET
|
||||||
"accountID" = COALESCE($3, "accountID"),
|
"accountID" = COALESCE($3, "accountID"),
|
||||||
firstname = COALESCE($4, firstname),
|
"firstname" = COALESCE($4, "firstname"),
|
||||||
lastname = COALESCE($5, lastname),
|
"lastname" = COALESCE($5, "lastname"),
|
||||||
birthday = COALESCE($6, birthday),
|
"birthday" = COALESCE($6, "birthday"),
|
||||||
city = COALESCE($7, city),
|
"city" = COALESCE($7, "city"),
|
||||||
zip = COALESCE($8, zip),
|
"zip" = COALESCE($8, "zip"),
|
||||||
street = COALESCE($9, street),
|
"street" = COALESCE($9, "street"),
|
||||||
country = COALESCE($10, country),
|
"country" = COALESCE($10, "country"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed
|
RETURNING "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
@ -12,12 +12,12 @@ import (
|
|||||||
|
|
||||||
const createProvider = `-- name: CreateProvider :one
|
const createProvider = `-- name: CreateProvider :one
|
||||||
INSERT INTO providers (
|
INSERT INTO providers (
|
||||||
name,
|
"name",
|
||||||
description,
|
"description",
|
||||||
category,
|
"category",
|
||||||
email,
|
"email",
|
||||||
creator,
|
"creator",
|
||||||
changer
|
"changer"
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6
|
$1, $2, $3, $4, $5, $6
|
||||||
) RETURNING "ID", name, description, category, email, creator, created, changer, changed
|
) RETURNING "ID", name, description, category, email, creator, created, changer, changed
|
||||||
@ -90,7 +90,7 @@ func (q *Queries) GetProvider(ctx context.Context, id int64) (Provider, error) {
|
|||||||
|
|
||||||
const listProviders = `-- name: ListProviders :many
|
const listProviders = `-- name: ListProviders :many
|
||||||
SELECT "ID", name, description, category, email, creator, created, changer, changed FROM providers
|
SELECT "ID", name, description, category, email, creator, created, changer, changed FROM providers
|
||||||
ORDER BY name
|
ORDER BY "name"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2
|
OFFSET $2
|
||||||
`
|
`
|
||||||
@ -136,12 +136,12 @@ func (q *Queries) ListProviders(ctx context.Context, arg ListProvidersParams) ([
|
|||||||
const updateProvider = `-- name: UpdateProvider :one
|
const updateProvider = `-- name: UpdateProvider :one
|
||||||
UPDATE providers
|
UPDATE providers
|
||||||
SET
|
SET
|
||||||
name = COALESCE($3, name),
|
"name" = COALESCE($3, "name"),
|
||||||
description = COALESCE($4, description),
|
"description" = COALESCE($4, "description"),
|
||||||
category = COALESCE($5, category),
|
"category" = COALESCE($5, "category"),
|
||||||
email = COALESCE($6, email),
|
"email" = COALESCE($6, "email"),
|
||||||
changer = $2,
|
"changer" = $2,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $1
|
WHERE "ID" = $1
|
||||||
RETURNING "ID", name, description, category, email, creator, created, changer, changed
|
RETURNING "ID", name, description, category, email, creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
@ -113,7 +113,7 @@ func (q *Queries) GetReturn(ctx context.Context, id int64) (Return, error) {
|
|||||||
|
|
||||||
const listReturns = `-- name: ListReturns :many
|
const listReturns = `-- name: ListReturns :many
|
||||||
SELECT "ID", "personID", "providerID", name, description, category, email, status, creator, created, changer, changed FROM returns
|
SELECT "ID", "personID", "providerID", name, description, category, email, status, creator, created, changer, changed FROM returns
|
||||||
ORDER BY name
|
ORDER BY "name"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2
|
OFFSET $2
|
||||||
`
|
`
|
||||||
@ -169,8 +169,8 @@ SET
|
|||||||
"category" = COALESCE($5, "category"),
|
"category" = COALESCE($5, "category"),
|
||||||
"email" = COALESCE($6, "email"),
|
"email" = COALESCE($6, "email"),
|
||||||
"status" = COALESCE($7, "status"),
|
"status" = COALESCE($7, "status"),
|
||||||
changer = $8,
|
"changer" = $8,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $9
|
WHERE "ID" = $9
|
||||||
RETURNING "ID", "personID", "providerID", name, description, category, email, status, creator, created, changer, changed
|
RETURNING "ID", "personID", "providerID", name, description, category, email, status, creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
@ -87,7 +87,7 @@ func (q *Queries) GetReturnsLog(ctx context.Context, id int64) (ReturnsLog, erro
|
|||||||
|
|
||||||
const listReturnsLogs = `-- name: ListReturnsLogs :many
|
const listReturnsLogs = `-- name: ListReturnsLogs :many
|
||||||
SELECT "ID", "returnID", "mailID", status, creator, created, changer, changed FROM "returnsLog"
|
SELECT "ID", "returnID", "mailID", status, creator, created, changer, changed FROM "returnsLog"
|
||||||
ORDER BY status
|
ORDER BY "status"
|
||||||
LIMIT $1
|
LIMIT $1
|
||||||
OFFSET $2
|
OFFSET $2
|
||||||
`
|
`
|
||||||
@ -135,8 +135,8 @@ SET
|
|||||||
"returnID" = COALESCE($2, "returnID"),
|
"returnID" = COALESCE($2, "returnID"),
|
||||||
"mailID" = COALESCE($3, "mailID"),
|
"mailID" = COALESCE($3, "mailID"),
|
||||||
"status" = COALESCE($4, "status"),
|
"status" = COALESCE($4, "status"),
|
||||||
changer = $1,
|
"changer" = $1,
|
||||||
changed = now()
|
"changed" = now()
|
||||||
WHERE "ID" = $5
|
WHERE "ID" = $5
|
||||||
RETURNING "ID", "returnID", "mailID", status, creator, created, changer, changed
|
RETURNING "ID", "returnID", "mailID", status, creator, created, changer, changed
|
||||||
`
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user