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

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