update sqlc gen

This commit is contained in:
Pavel 2024-05-06 14:06:55 +03:00
parent dacc4c4eb5
commit eeb6853b6a
2 changed files with 10 additions and 10 deletions

@ -661,7 +661,7 @@ INSERT INTO tokens (AccountID, RefreshToken, AccessToken, AuthCode, Expiration,
VALUES ($1, $2, $3, $4, $5, $6);
-- name: WebhookUpdate :exec
UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp($3) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp($4) AT TIME ZONE 'UTC' + INTERVAL '3 hours'
UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp(($3)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp(($4)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours'
WHERE accountID = $5;
-- name: GetAllTokens :many
@ -1026,4 +1026,4 @@ INSERT INTO amoCRMStatuses (AccountID, DealID, AnswerID, Status)
SELECT u.AmoID, $1, $2, $3
FROM tokens AS t
JOIN users AS u ON t.AccountID = u.AccountID
WHERE t.AccessToken = $4;
WHERE t.AccessToken = $4;

@ -3355,24 +3355,24 @@ func (q *Queries) WebhookDelete(ctx context.Context, amouserid int32) error {
}
const webhookUpdate = `-- name: WebhookUpdate :exec
UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp($3) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp($4) AT TIME ZONE 'UTC' + INTERVAL '3 hours'
UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp(($3)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp(($4)::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours'
WHERE accountID = $5
`
type WebhookUpdateParams struct {
Accesstoken string `db:"accesstoken" json:"accesstoken"`
Refreshtoken string `db:"refreshtoken" json:"refreshtoken"`
ToTimestamp float64 `db:"to_timestamp" json:"to_timestamp"`
ToTimestamp_2 float64 `db:"to_timestamp_2" json:"to_timestamp_2"`
Accountid string `db:"accountid" json:"accountid"`
Accesstoken string `db:"accesstoken" json:"accesstoken"`
Refreshtoken string `db:"refreshtoken" json:"refreshtoken"`
Column3 int64 `db:"column_3" json:"column_3"`
Column4 int64 `db:"column_4" json:"column_4"`
Accountid string `db:"accountid" json:"accountid"`
}
func (q *Queries) WebhookUpdate(ctx context.Context, arg WebhookUpdateParams) error {
_, err := q.db.ExecContext(ctx, webhookUpdate,
arg.Accesstoken,
arg.Refreshtoken,
arg.ToTimestamp,
arg.ToTimestamp_2,
arg.Column3,
arg.Column4,
arg.Accountid,
)
return err