update sqlc gen
This commit is contained in:
parent
34628bcc93
commit
759ec37def
@ -661,7 +661,22 @@ INSERT INTO tokens (AccountID, RefreshToken, AccessToken, AuthCode, Expiration,
|
|||||||
VALUES ($1, $2, $3, $4, $5, $6);
|
VALUES ($1, $2, $3, $4, $5, $6);
|
||||||
|
|
||||||
-- name: WebhookUpdate :exec
|
-- name: WebhookUpdate :exec
|
||||||
UPDATE tokens SET AccessToken = $1, RefreshToken = $2, Expiration = $3, CreatedAt = $4 WHERE AccountID = $5;
|
UPDATE tokens
|
||||||
|
SET
|
||||||
|
AccessToken = updated_data.AccessToken,
|
||||||
|
RefreshToken = updated_data.RefreshToken,
|
||||||
|
Expiration = updated_data.Expiration,
|
||||||
|
CreatedAt = updated_data.CreatedAt
|
||||||
|
FROM
|
||||||
|
jsonb_to_recordset($1::jsonb) AS updated_data(
|
||||||
|
AccountID VARCHAR(30),
|
||||||
|
AccessToken TEXT,
|
||||||
|
RefreshToken TEXT,
|
||||||
|
Expiration TIMESTAMP,
|
||||||
|
CreatedAt TIMESTAMP
|
||||||
|
)
|
||||||
|
WHERE
|
||||||
|
tokens.AccountID = updated_data.AccountID;
|
||||||
|
|
||||||
-- name: GetAllTokens :many
|
-- name: GetAllTokens :many
|
||||||
SELECT * FROM tokens;
|
SELECT * FROM tokens;
|
||||||
|
@ -2781,25 +2781,26 @@ func (q *Queries) WebhookDelete(ctx context.Context, accountid string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const webhookUpdate = `-- name: WebhookUpdate :exec
|
const webhookUpdate = `-- name: WebhookUpdate :exec
|
||||||
UPDATE tokens SET AccessToken = $1, RefreshToken = $2, Expiration = $3, CreatedAt = $4 WHERE AccountID = $5
|
UPDATE tokens
|
||||||
|
SET
|
||||||
|
AccessToken = updated_data.AccessToken,
|
||||||
|
RefreshToken = updated_data.RefreshToken,
|
||||||
|
Expiration = updated_data.Expiration,
|
||||||
|
CreatedAt = updated_data.CreatedAt
|
||||||
|
FROM
|
||||||
|
jsonb_to_recordset($1::jsonb) AS updated_data(
|
||||||
|
AccountID VARCHAR(30),
|
||||||
|
AccessToken TEXT,
|
||||||
|
RefreshToken TEXT,
|
||||||
|
Expiration TIMESTAMP,
|
||||||
|
CreatedAt TIMESTAMP
|
||||||
|
)
|
||||||
|
WHERE
|
||||||
|
tokens.AccountID = updated_data.AccountID
|
||||||
`
|
`
|
||||||
|
|
||||||
type WebhookUpdateParams struct {
|
func (q *Queries) WebhookUpdate(ctx context.Context, dollar_1 json.RawMessage) error {
|
||||||
Accesstoken string `db:"accesstoken" json:"accesstoken"`
|
_, err := q.db.ExecContext(ctx, webhookUpdate, dollar_1)
|
||||||
Refreshtoken string `db:"refreshtoken" json:"refreshtoken"`
|
|
||||||
Expiration time.Time `db:"expiration" json:"expiration"`
|
|
||||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
|
||||||
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.Expiration,
|
|
||||||
arg.Createdat,
|
|
||||||
arg.Accountid,
|
|
||||||
)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user