update sqlc gen

This commit is contained in:
Pavel 2024-05-06 14:00:28 +03:00
parent e12c66a560
commit f57e343116

@ -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
}