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);
|
||||
|
||||
-- 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
|
||||
SELECT * FROM tokens;
|
||||
@ -842,4 +857,4 @@ VALUES ($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT (AmoID) DO NOTHING;
|
||||
|
||||
-- name: UpdateUsers :exec
|
||||
UPDATE users SET Name = $2, Email = $3, Role = $4, "Group" = $5, AmoUserID = $6 WHERE AmoID = $1;
|
||||
UPDATE users SET Name = $2, Email = $3, Role = $4, "Group" = $5, AmoUserID = $6 WHERE AmoID = $1;
|
||||
|
@ -2781,25 +2781,26 @@ func (q *Queries) WebhookDelete(ctx context.Context, accountid string) error {
|
||||
}
|
||||
|
||||
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 {
|
||||
Accesstoken string `db:"accesstoken" json:"accesstoken"`
|
||||
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,
|
||||
)
|
||||
func (q *Queries) WebhookUpdate(ctx context.Context, dollar_1 json.RawMessage) error {
|
||||
_, err := q.db.ExecContext(ctx, webhookUpdate, dollar_1)
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user