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
|
||||
INSERT INTO accounts (
|
||||
passwordhash,
|
||||
firstname,
|
||||
lastname,
|
||||
birthday,
|
||||
email,
|
||||
phone,
|
||||
city,
|
||||
zip,
|
||||
street,
|
||||
country,
|
||||
creator,
|
||||
changer
|
||||
"passwordhash",
|
||||
"firstname",
|
||||
"lastname",
|
||||
"birthday",
|
||||
"email",
|
||||
"phone",
|
||||
"city",
|
||||
"zip",
|
||||
"street",
|
||||
"country",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11
|
||||
) RETURNING *;
|
||||
|
||||
-- name: ListAccounts :many
|
||||
SELECT * FROM accounts
|
||||
ORDER BY lastname, firstname
|
||||
ORDER BY "lastname", "firstname"
|
||||
LIMIT $1
|
||||
OFFSET $2;
|
||||
|
||||
-- name: UpdateAccount :one
|
||||
UPDATE accounts
|
||||
SET
|
||||
passwordhash = COALESCE(sqlc.narg(passwordhash), passwordhash),
|
||||
firstname = COALESCE(sqlc.narg(firstname), firstname),
|
||||
lastname = COALESCE(sqlc.narg(lastname), lastname),
|
||||
birthday = COALESCE(sqlc.narg(birthday), birthday),
|
||||
email = COALESCE(sqlc.narg(email), email),
|
||||
phone = COALESCE(sqlc.narg(phone), phone),
|
||||
city = COALESCE(sqlc.narg(city), city),
|
||||
zip = COALESCE(sqlc.narg(zip), zip),
|
||||
street = COALESCE(sqlc.narg(street), street),
|
||||
country = COALESCE(sqlc.narg(country), country),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"passwordhash" = COALESCE(sqlc.narg(passwordhash), "passwordhash"),
|
||||
"firstname" = COALESCE(sqlc.narg(firstname), "firstname"),
|
||||
"lastname" = COALESCE(sqlc.narg(lastname), "lastname"),
|
||||
"birthday" = COALESCE(sqlc.narg(birthday), "birthday"),
|
||||
"email" = COALESCE(sqlc.narg(email), "email"),
|
||||
"phone" = COALESCE(sqlc.narg(phone), "phone"),
|
||||
"city" = COALESCE(sqlc.narg(city), "city"),
|
||||
"zip" = COALESCE(sqlc.narg(zip), "zip"),
|
||||
"street" = COALESCE(sqlc.narg(street), "street"),
|
||||
"country" = COALESCE(sqlc.narg(country), "country"),
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING *;
|
||||
|
||||
|
@ -5,12 +5,12 @@ WHERE "ID" = $1 LIMIT 1;
|
||||
-- name: CreateDocumentUpload :one
|
||||
INSERT INTO documents (
|
||||
"personID",
|
||||
name,
|
||||
type,
|
||||
path,
|
||||
url,
|
||||
creator,
|
||||
changer
|
||||
"name",
|
||||
"type",
|
||||
"path",
|
||||
"url",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7
|
||||
) RETURNING *;
|
||||
@ -18,19 +18,19 @@ INSERT INTO documents (
|
||||
-- name: CreateDocumentMail :one
|
||||
INSERT INTO documents (
|
||||
"mailID",
|
||||
name,
|
||||
type,
|
||||
path,
|
||||
url,
|
||||
creator,
|
||||
changer
|
||||
"name",
|
||||
"type",
|
||||
"path",
|
||||
"url",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7
|
||||
) RETURNING *;
|
||||
|
||||
-- name: ListDocuments :many
|
||||
SELECT * FROM documents
|
||||
ORDER BY valid, type, name
|
||||
ORDER BY "valid", "type", "name"
|
||||
LIMIT $1
|
||||
OFFSET $2;
|
||||
|
||||
@ -38,10 +38,10 @@ OFFSET $2;
|
||||
UPDATE documents
|
||||
SET
|
||||
"personID" = COALESCE(sqlc.narg(personID), "personID"),
|
||||
name = COALESCE(sqlc.narg(name), name),
|
||||
type = COALESCE(sqlc.narg(type), type),
|
||||
path = COALESCE(sqlc.narg(path), path),
|
||||
url = COALESCE(sqlc.narg(url), url),
|
||||
"name" = COALESCE(sqlc.narg(name), "name"),
|
||||
"type" = COALESCE(sqlc.narg(type), "type"),
|
||||
"path" = COALESCE(sqlc.narg(path), "path"),
|
||||
"url" = COALESCE(sqlc.narg(url), "url"),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
WHERE "ID" = $1
|
||||
@ -50,22 +50,22 @@ RETURNING *;
|
||||
-- name: ValidateDocument :one
|
||||
UPDATE documents
|
||||
SET
|
||||
valid = true,
|
||||
"valid" = true,
|
||||
"validDate" = now(),
|
||||
"validatedBy" = $2,
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING *;
|
||||
|
||||
-- name: InvalidateDocument :one
|
||||
UPDATE documents
|
||||
SET
|
||||
valid = false,
|
||||
"valid" = false,
|
||||
"validDate" = NULL,
|
||||
"validatedBy" = NULL,
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING *;
|
||||
|
||||
|
@ -6,12 +6,12 @@ WHERE "ID" = $1 LIMIT 1;
|
||||
INSERT INTO mails (
|
||||
"from",
|
||||
"to",
|
||||
cc,
|
||||
"cc",
|
||||
"subject",
|
||||
body,
|
||||
"body",
|
||||
"timestamp",
|
||||
creator,
|
||||
changer
|
||||
"creator",
|
||||
"changer"
|
||||
)
|
||||
VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8
|
||||
|
@ -6,15 +6,15 @@ WHERE "ID" = $1 LIMIT 1;
|
||||
INSERT INTO payments (
|
||||
"accountID",
|
||||
"paymentCategory",
|
||||
bankname,
|
||||
"bankname",
|
||||
"IBAN",
|
||||
"BIC",
|
||||
"paypalAccount",
|
||||
"paypalID",
|
||||
"paymentSystem",
|
||||
"type",
|
||||
creator,
|
||||
changer
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
|
||||
) RETURNING *;
|
||||
@ -30,15 +30,15 @@ UPDATE payments
|
||||
SET
|
||||
"accountID" = COALESCE(sqlc.narg(accountID), "accountID"),
|
||||
"paymentCategory" = COALESCE(sqlc.narg(paymentCategory), "paymentCategory"),
|
||||
bankname = COALESCE(sqlc.narg(bankname), bankname),
|
||||
"bankname" = COALESCE(sqlc.narg(bankname), "bankname"),
|
||||
"IBAN" = COALESCE(sqlc.narg(IBAN), "IBAN"),
|
||||
"BIC" = COALESCE(sqlc.narg(BIC), "BIC"),
|
||||
"paypalAccount" = COALESCE(sqlc.narg(paypalAccount), "paypalAccount"),
|
||||
"paypalID" = COALESCE(sqlc.narg(paypalID), "paypalID"),
|
||||
"paymentSystem" = COALESCE(sqlc.narg(paymentSystem), "paymentSystem"),
|
||||
"type" = COALESCE(sqlc.narg(type), "type"),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING *;
|
||||
|
||||
|
@ -5,22 +5,22 @@ WHERE "ID" = $1 LIMIT 1;
|
||||
-- name: CreatePerson :one
|
||||
INSERT INTO persons (
|
||||
"accountID",
|
||||
firstname,
|
||||
lastname,
|
||||
birthday,
|
||||
city,
|
||||
zip,
|
||||
street,
|
||||
country,
|
||||
creator,
|
||||
changer
|
||||
"firstname",
|
||||
"lastname",
|
||||
"birthday",
|
||||
"city",
|
||||
"zip",
|
||||
"street",
|
||||
"country",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
||||
) RETURNING *;
|
||||
|
||||
-- name: ListPersons :many
|
||||
SELECT * FROM persons
|
||||
ORDER BY lastname, firstname
|
||||
ORDER BY "lastname", "firstname"
|
||||
LIMIT $1
|
||||
OFFSET $2;
|
||||
|
||||
@ -28,15 +28,15 @@ OFFSET $2;
|
||||
UPDATE persons
|
||||
SET
|
||||
"accountID" = COALESCE(sqlc.narg(accountID), "accountID"),
|
||||
firstname = COALESCE(sqlc.narg(firstname), firstname),
|
||||
lastname = COALESCE(sqlc.narg(lastname), lastname),
|
||||
birthday = COALESCE(sqlc.narg(birthday), birthday),
|
||||
city = COALESCE(sqlc.narg(city), city),
|
||||
zip = COALESCE(sqlc.narg(zip), zip),
|
||||
street = COALESCE(sqlc.narg(street), street),
|
||||
country = COALESCE(sqlc.narg(country), country),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"firstname" = COALESCE(sqlc.narg(firstname), "firstname"),
|
||||
"lastname" = COALESCE(sqlc.narg(lastname), "lastname"),
|
||||
"birthday" = COALESCE(sqlc.narg(birthday), "birthday"),
|
||||
"city" = COALESCE(sqlc.narg(city), "city"),
|
||||
"zip" = COALESCE(sqlc.narg(zip), "zip"),
|
||||
"street" = COALESCE(sqlc.narg(street), "street"),
|
||||
"country" = COALESCE(sqlc.narg(country), "country"),
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING *;
|
||||
|
||||
|
@ -4,31 +4,31 @@ WHERE "ID" = $1 LIMIT 1;
|
||||
|
||||
-- name: CreateProvider :one
|
||||
INSERT INTO providers (
|
||||
name,
|
||||
description,
|
||||
category,
|
||||
email,
|
||||
creator,
|
||||
changer
|
||||
"name",
|
||||
"description",
|
||||
"category",
|
||||
"email",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6
|
||||
) RETURNING *;
|
||||
|
||||
-- name: ListProviders :many
|
||||
SELECT * FROM providers
|
||||
ORDER BY name
|
||||
ORDER BY "name"
|
||||
LIMIT $1
|
||||
OFFSET $2;
|
||||
|
||||
-- name: UpdateProvider :one
|
||||
UPDATE providers
|
||||
SET
|
||||
name = COALESCE(sqlc.narg(name), name),
|
||||
description = COALESCE(sqlc.narg(description), description),
|
||||
category = COALESCE(sqlc.narg(category), category),
|
||||
email = COALESCE(sqlc.narg(email), email),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"name" = COALESCE(sqlc.narg(name), "name"),
|
||||
"description" = COALESCE(sqlc.narg(description), "description"),
|
||||
"category" = COALESCE(sqlc.narg(category), "category"),
|
||||
"email" = COALESCE(sqlc.narg(email), "email"),
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING *;
|
||||
|
||||
|
@ -27,7 +27,7 @@ INSERT INTO returns (
|
||||
|
||||
-- name: ListReturns :many
|
||||
SELECT * FROM returns
|
||||
ORDER BY name
|
||||
ORDER BY "name"
|
||||
LIMIT $1
|
||||
OFFSET $2;
|
||||
|
||||
@ -41,8 +41,8 @@ SET
|
||||
"category" = COALESCE(sqlc.narg(category), "category"),
|
||||
"email" = COALESCE(sqlc.narg(email), "email"),
|
||||
"status" = COALESCE(sqlc.narg(status), "status"),
|
||||
changer = sqlc.arg(changer),
|
||||
changed = now()
|
||||
"changer" = sqlc.arg(changer),
|
||||
"changed" = now()
|
||||
WHERE "ID" = sqlc.arg(ID)
|
||||
RETURNING *;
|
||||
|
||||
|
@ -19,7 +19,7 @@ INSERT INTO "returnsLog" (
|
||||
|
||||
-- name: ListReturnsLogs :many
|
||||
SELECT * FROM "returnsLog"
|
||||
ORDER BY status
|
||||
ORDER BY "status"
|
||||
LIMIT $1
|
||||
OFFSET $2;
|
||||
|
||||
@ -29,8 +29,8 @@ SET
|
||||
"returnID" = COALESCE(sqlc.narg(returnID), "returnID"),
|
||||
"mailID" = COALESCE(sqlc.narg(mailID), "mailID"),
|
||||
"status" = COALESCE(sqlc.narg(status), "status"),
|
||||
changer = $1,
|
||||
changed = now()
|
||||
"changer" = $1,
|
||||
"changed" = now()
|
||||
WHERE "ID" = sqlc.arg(ID)
|
||||
RETURNING *;
|
||||
|
||||
|
@ -13,18 +13,18 @@ import (
|
||||
|
||||
const createAccount = `-- name: CreateAccount :one
|
||||
INSERT INTO accounts (
|
||||
passwordhash,
|
||||
firstname,
|
||||
lastname,
|
||||
birthday,
|
||||
email,
|
||||
phone,
|
||||
city,
|
||||
zip,
|
||||
street,
|
||||
country,
|
||||
creator,
|
||||
changer
|
||||
"passwordhash",
|
||||
"firstname",
|
||||
"lastname",
|
||||
"birthday",
|
||||
"email",
|
||||
"phone",
|
||||
"city",
|
||||
"zip",
|
||||
"street",
|
||||
"country",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$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
|
||||
@ -163,7 +163,7 @@ func (q *Queries) GetAccountForUpdate(ctx context.Context, id int64) (Account, e
|
||||
|
||||
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
|
||||
ORDER BY lastname, firstname
|
||||
ORDER BY "lastname", "firstname"
|
||||
LIMIT $1
|
||||
OFFSET $2
|
||||
`
|
||||
@ -220,18 +220,18 @@ func (q *Queries) ListAccounts(ctx context.Context, arg ListAccountsParams) ([]A
|
||||
const updateAccount = `-- name: UpdateAccount :one
|
||||
UPDATE accounts
|
||||
SET
|
||||
passwordhash = COALESCE($3, passwordhash),
|
||||
firstname = COALESCE($4, firstname),
|
||||
lastname = COALESCE($5, lastname),
|
||||
birthday = COALESCE($6, birthday),
|
||||
email = COALESCE($7, email),
|
||||
phone = COALESCE($8, phone),
|
||||
city = COALESCE($9, city),
|
||||
zip = COALESCE($10, zip),
|
||||
street = COALESCE($11, street),
|
||||
country = COALESCE($12, country),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"passwordhash" = COALESCE($3, "passwordhash"),
|
||||
"firstname" = COALESCE($4, "firstname"),
|
||||
"lastname" = COALESCE($5, "lastname"),
|
||||
"birthday" = COALESCE($6, "birthday"),
|
||||
"email" = COALESCE($7, "email"),
|
||||
"phone" = COALESCE($8, "phone"),
|
||||
"city" = COALESCE($9, "city"),
|
||||
"zip" = COALESCE($10, "zip"),
|
||||
"street" = COALESCE($11, "street"),
|
||||
"country" = COALESCE($12, "country"),
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
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
|
||||
INSERT INTO documents (
|
||||
"mailID",
|
||||
name,
|
||||
type,
|
||||
path,
|
||||
url,
|
||||
creator,
|
||||
changer
|
||||
"name",
|
||||
"type",
|
||||
"path",
|
||||
"url",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7
|
||||
) 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
|
||||
INSERT INTO documents (
|
||||
"personID",
|
||||
name,
|
||||
type,
|
||||
path,
|
||||
url,
|
||||
creator,
|
||||
changer
|
||||
"name",
|
||||
"type",
|
||||
"path",
|
||||
"url",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7
|
||||
) 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
|
||||
UPDATE documents
|
||||
SET
|
||||
valid = false,
|
||||
"valid" = false,
|
||||
"validDate" = NULL,
|
||||
"validatedBy" = NULL,
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
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
|
||||
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
|
||||
OFFSET $2
|
||||
`
|
||||
@ -248,10 +248,10 @@ const updateDocument = `-- name: UpdateDocument :one
|
||||
UPDATE documents
|
||||
SET
|
||||
"personID" = COALESCE($3, "personID"),
|
||||
name = COALESCE($4, name),
|
||||
type = COALESCE($5, type),
|
||||
path = COALESCE($6, path),
|
||||
url = COALESCE($7, url),
|
||||
"name" = COALESCE($4, "name"),
|
||||
"type" = COALESCE($5, "type"),
|
||||
"path" = COALESCE($6, "path"),
|
||||
"url" = COALESCE($7, "url"),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
WHERE "ID" = $1
|
||||
@ -301,11 +301,11 @@ func (q *Queries) UpdateDocument(ctx context.Context, arg UpdateDocumentParams)
|
||||
const validateDocument = `-- name: ValidateDocument :one
|
||||
UPDATE documents
|
||||
SET
|
||||
valid = true,
|
||||
"valid" = true,
|
||||
"validDate" = now(),
|
||||
"validatedBy" = $2,
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
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 (
|
||||
"from",
|
||||
"to",
|
||||
cc,
|
||||
"cc",
|
||||
"subject",
|
||||
body,
|
||||
"body",
|
||||
"timestamp",
|
||||
creator,
|
||||
changer
|
||||
"creator",
|
||||
"changer"
|
||||
)
|
||||
VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8
|
||||
|
@ -14,15 +14,15 @@ const createPayment = `-- name: CreatePayment :one
|
||||
INSERT INTO payments (
|
||||
"accountID",
|
||||
"paymentCategory",
|
||||
bankname,
|
||||
"bankname",
|
||||
"IBAN",
|
||||
"BIC",
|
||||
"paypalAccount",
|
||||
"paypalID",
|
||||
"paymentSystem",
|
||||
"type",
|
||||
creator,
|
||||
changer
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$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
|
||||
@ -168,15 +168,15 @@ UPDATE payments
|
||||
SET
|
||||
"accountID" = COALESCE($3, "accountID"),
|
||||
"paymentCategory" = COALESCE($4, "paymentCategory"),
|
||||
bankname = COALESCE($5, bankname),
|
||||
"bankname" = COALESCE($5, "bankname"),
|
||||
"IBAN" = COALESCE($6, "IBAN"),
|
||||
"BIC" = COALESCE($7, "BIC"),
|
||||
"paypalAccount" = COALESCE($8, "paypalAccount"),
|
||||
"paypalID" = COALESCE($9, "paypalID"),
|
||||
"paymentSystem" = COALESCE($10, "paymentSystem"),
|
||||
"type" = COALESCE($11, "type"),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
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
|
||||
INSERT INTO persons (
|
||||
"accountID",
|
||||
firstname,
|
||||
lastname,
|
||||
birthday,
|
||||
city,
|
||||
zip,
|
||||
street,
|
||||
country,
|
||||
creator,
|
||||
changer
|
||||
"firstname",
|
||||
"lastname",
|
||||
"birthday",
|
||||
"city",
|
||||
"zip",
|
||||
"street",
|
||||
"country",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10
|
||||
) 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
|
||||
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
|
||||
OFFSET $2
|
||||
`
|
||||
@ -162,15 +162,15 @@ const updatePerson = `-- name: UpdatePerson :one
|
||||
UPDATE persons
|
||||
SET
|
||||
"accountID" = COALESCE($3, "accountID"),
|
||||
firstname = COALESCE($4, firstname),
|
||||
lastname = COALESCE($5, lastname),
|
||||
birthday = COALESCE($6, birthday),
|
||||
city = COALESCE($7, city),
|
||||
zip = COALESCE($8, zip),
|
||||
street = COALESCE($9, street),
|
||||
country = COALESCE($10, country),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"firstname" = COALESCE($4, "firstname"),
|
||||
"lastname" = COALESCE($5, "lastname"),
|
||||
"birthday" = COALESCE($6, "birthday"),
|
||||
"city" = COALESCE($7, "city"),
|
||||
"zip" = COALESCE($8, "zip"),
|
||||
"street" = COALESCE($9, "street"),
|
||||
"country" = COALESCE($10, "country"),
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
RETURNING "ID", "accountID", firstname, lastname, birthday, city, zip, street, country, creator, created, changer, changed
|
||||
`
|
||||
|
@ -12,12 +12,12 @@ import (
|
||||
|
||||
const createProvider = `-- name: CreateProvider :one
|
||||
INSERT INTO providers (
|
||||
name,
|
||||
description,
|
||||
category,
|
||||
email,
|
||||
creator,
|
||||
changer
|
||||
"name",
|
||||
"description",
|
||||
"category",
|
||||
"email",
|
||||
"creator",
|
||||
"changer"
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6
|
||||
) 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
|
||||
SELECT "ID", name, description, category, email, creator, created, changer, changed FROM providers
|
||||
ORDER BY name
|
||||
ORDER BY "name"
|
||||
LIMIT $1
|
||||
OFFSET $2
|
||||
`
|
||||
@ -136,12 +136,12 @@ func (q *Queries) ListProviders(ctx context.Context, arg ListProvidersParams) ([
|
||||
const updateProvider = `-- name: UpdateProvider :one
|
||||
UPDATE providers
|
||||
SET
|
||||
name = COALESCE($3, name),
|
||||
description = COALESCE($4, description),
|
||||
category = COALESCE($5, category),
|
||||
email = COALESCE($6, email),
|
||||
changer = $2,
|
||||
changed = now()
|
||||
"name" = COALESCE($3, "name"),
|
||||
"description" = COALESCE($4, "description"),
|
||||
"category" = COALESCE($5, "category"),
|
||||
"email" = COALESCE($6, "email"),
|
||||
"changer" = $2,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $1
|
||||
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
|
||||
SELECT "ID", "personID", "providerID", name, description, category, email, status, creator, created, changer, changed FROM returns
|
||||
ORDER BY name
|
||||
ORDER BY "name"
|
||||
LIMIT $1
|
||||
OFFSET $2
|
||||
`
|
||||
@ -169,8 +169,8 @@ SET
|
||||
"category" = COALESCE($5, "category"),
|
||||
"email" = COALESCE($6, "email"),
|
||||
"status" = COALESCE($7, "status"),
|
||||
changer = $8,
|
||||
changed = now()
|
||||
"changer" = $8,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $9
|
||||
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
|
||||
SELECT "ID", "returnID", "mailID", status, creator, created, changer, changed FROM "returnsLog"
|
||||
ORDER BY status
|
||||
ORDER BY "status"
|
||||
LIMIT $1
|
||||
OFFSET $2
|
||||
`
|
||||
@ -135,8 +135,8 @@ SET
|
||||
"returnID" = COALESCE($2, "returnID"),
|
||||
"mailID" = COALESCE($3, "mailID"),
|
||||
"status" = COALESCE($4, "status"),
|
||||
changer = $1,
|
||||
changed = now()
|
||||
"changer" = $1,
|
||||
"changed" = now()
|
||||
WHERE "ID" = $5
|
||||
RETURNING "ID", "returnID", "mailID", status, creator, created, changer, changed
|
||||
`
|
||||
|
Loading…
x
Reference in New Issue
Block a user