update sqlc gen

This commit is contained in:
Pavel 2024-04-22 17:45:39 +03:00
parent 33c04c20f3
commit 4ca35ec382
2 changed files with 18 additions and 18 deletions

@ -763,7 +763,7 @@ WHERE f.amoID = (update_data ->> 'AmoID')::INT
-- name: CheckTags :many
WITH user_data AS (
SELECT AmoID, AccountID
SELECT AmoID
FROM users
WHERE users.AccountID = $1
), new_tags AS (
@ -785,7 +785,7 @@ WITH user_data AS (
ON CONFLICT (amoID, accountID, Entity) DO NOTHING
RETURNING *
)
SELECT nt.*,ud.AccountID
SELECT nt.*,ud.AmoID
FROM new_tags nt
JOIN user_data ud ON true
WHERE NOT EXISTS (
@ -824,7 +824,7 @@ WHERE NOT EXISTS (
-- name: CheckFields :many
WITH user_data AS (
SELECT AmoID, AccountID
SELECT AmoID
FROM users
WHERE users.AccountID = $1
), new_fields AS (
@ -849,7 +849,7 @@ WITH user_data AS (
ON CONFLICT (amoID, accountID, entity) DO NOTHING
RETURNING *
)
SELECT nf.*,ud.AccountID
SELECT nf.*,ud.AmoID
FROM new_fields nf
JOIN user_data ud ON true
WHERE NOT EXISTS (

@ -168,7 +168,7 @@ func (q *Queries) CheckExpired(ctx context.Context) ([]Token, error) {
const checkFields = `-- name: CheckFields :many
WITH user_data AS (
SELECT AmoID, AccountID
SELECT AmoID
FROM users
WHERE users.AccountID = $1
), new_fields AS (
@ -193,11 +193,11 @@ WITH user_data AS (
ON CONFLICT (amoID, accountID, entity) DO NOTHING
RETURNING id, amoid, code, accountid, name, entity, type, deleted, createdat
)
SELECT nf.amoid, nf.code, nf.name, nf.entity, nf.type, nf.createdat,ud.AccountID
SELECT nf.amoid, nf.code, nf.name, nf.entity, nf.type, nf.createdat,ud.AmoID
FROM new_fields nf
JOIN user_data ud ON true
WHERE NOT EXISTS (
SELECT id, ins.amoid, code, ins.accountid, name, entity, type, deleted, createdat, ud.amoid, ud.accountid
SELECT id, ins.amoid, code, accountid, name, entity, type, deleted, createdat, ud.amoid
FROM inserted_fields ins
JOIN user_data ud ON true
WHERE ins.amoID = nf.amoID AND ins.accountID = ud.amoid AND ins.Entity = nf.Entity
@ -216,7 +216,7 @@ type CheckFieldsRow struct {
Entity interface{} `db:"entity" json:"entity"`
Type string `db:"type" json:"type"`
Createdat interface{} `db:"createdat" json:"createdat"`
Accountid string `db:"accountid" json:"accountid"`
Amoid_2 int32 `db:"amoid_2" json:"amoid_2"`
}
func (q *Queries) CheckFields(ctx context.Context, arg CheckFieldsParams) ([]CheckFieldsRow, error) {
@ -235,7 +235,7 @@ func (q *Queries) CheckFields(ctx context.Context, arg CheckFieldsParams) ([]Che
&i.Entity,
&i.Type,
&i.Createdat,
&i.Accountid,
&i.Amoid_2,
); err != nil {
return nil, err
}
@ -455,7 +455,7 @@ func (q *Queries) CheckSteps(ctx context.Context, dollar_1 json.RawMessage) ([]C
const checkTags = `-- name: CheckTags :many
WITH user_data AS (
SELECT AmoID, AccountID
SELECT AmoID
FROM users
WHERE users.AccountID = $1
), new_tags AS (
@ -477,11 +477,11 @@ WITH user_data AS (
ON CONFLICT (amoID, accountID, Entity) DO NOTHING
RETURNING id, amoid, accountid, entity, name, color, deleted, createdat
)
SELECT nt.amoid, nt.entity, nt.name, nt.color,ud.AccountID
SELECT nt.amoid, nt.entity, nt.name, nt.color,ud.AmoID
FROM new_tags nt
JOIN user_data ud ON true
WHERE NOT EXISTS (
SELECT id, ins.amoid, ins.accountid, entity, name, color, deleted, createdat, ud.amoid, ud.accountid
SELECT id, ins.amoid, accountid, entity, name, color, deleted, createdat, ud.amoid
FROM inserted_tags ins
JOIN user_data ud ON true
WHERE ins.amoID = nt.amoID AND ins.accountID = ud.amoid AND ins.Entity = nt.Entity
@ -494,11 +494,11 @@ type CheckTagsParams struct {
}
type CheckTagsRow struct {
Amoid int32 `db:"amoid" json:"amoid"`
Entity interface{} `db:"entity" json:"entity"`
Name string `db:"name" json:"name"`
Color string `db:"color" json:"color"`
Accountid string `db:"accountid" json:"accountid"`
Amoid int32 `db:"amoid" json:"amoid"`
Entity interface{} `db:"entity" json:"entity"`
Name string `db:"name" json:"name"`
Color string `db:"color" json:"color"`
Amoid_2 int32 `db:"amoid_2" json:"amoid_2"`
}
func (q *Queries) CheckTags(ctx context.Context, arg CheckTagsParams) ([]CheckTagsRow, error) {
@ -515,7 +515,7 @@ func (q *Queries) CheckTags(ctx context.Context, arg CheckTagsParams) ([]CheckTa
&i.Entity,
&i.Name,
&i.Color,
&i.Accountid,
&i.Amoid_2,
); err != nil {
return nil, err
}