From f57e3431164b5c3ecf6001fc48f76ec54f71e396 Mon Sep 17 00:00:00 2001 From: Pavel Date: Mon, 6 May 2024 14:00:28 +0300 Subject: [PATCH] update sqlc gen --- dal/sqlcgen/queries.sql.go | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/dal/sqlcgen/queries.sql.go b/dal/sqlcgen/queries.sql.go index fe80c13..0005352 100644 --- a/dal/sqlcgen/queries.sql.go +++ b/dal/sqlcgen/queries.sql.go @@ -3355,17 +3355,26 @@ func (q *Queries) WebhookDelete(ctx context.Context, amouserid int32) error { } const webhookUpdate = `-- name: WebhookUpdate :exec -UPDATE tokens AS t -SET AccessToken = (update_data ->> 'access_token')::varchar(50), - RefreshToken = (update_data ->> 'refresh_token')::varchar(50), - Expiration = to_timestamp((update_data ->> 'expiration')::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours', - CreatedAt = to_timestamp((update_data ->> 'created_at')::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours' -FROM json_array_elements($1::json) AS update_data -WHERE t.accountID = (update_data ->> 'account_id')::VARCHAR(30) +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' +WHERE accountID = $5 ` -func (q *Queries) WebhookUpdate(ctx context.Context, dollar_1 json.RawMessage) error { - _, err := q.db.ExecContext(ctx, webhookUpdate, dollar_1) +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"` +} + +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.Accountid, + ) return err }