46 lines
1,022 B
Go
46 lines
1,022 B
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: authkey.sql
|
|
|
|
package sqlcgen
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const getAuthKey = `-- name: GetAuthKey :one
|
|
SELECT auth_key_id, body, server_salt, created_at
|
|
FROM auth_keys
|
|
WHERE auth_key_id = $1
|
|
`
|
|
|
|
func (q *Queries) GetAuthKey(ctx context.Context, authKeyID int64) (AuthKey, error) {
|
|
row := q.db.QueryRow(ctx, getAuthKey, authKeyID)
|
|
var i AuthKey
|
|
err := row.Scan(
|
|
&i.AuthKeyID,
|
|
&i.Body,
|
|
&i.ServerSalt,
|
|
&i.CreatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const upsertAuthKey = `-- name: UpsertAuthKey :exec
|
|
INSERT INTO auth_keys (auth_key_id, body, server_salt)
|
|
VALUES ($1, $2, $3)
|
|
ON CONFLICT (auth_key_id) DO UPDATE
|
|
SET body = EXCLUDED.body, server_salt = EXCLUDED.server_salt
|
|
`
|
|
|
|
type UpsertAuthKeyParams struct {
|
|
AuthKeyID int64
|
|
Body []byte
|
|
ServerSalt int64
|
|
}
|
|
|
|
func (q *Queries) UpsertAuthKey(ctx context.Context, arg UpsertAuthKeyParams) error {
|
|
_, err := q.db.Exec(ctx, upsertAuthKey, arg.AuthKeyID, arg.Body, arg.ServerSalt)
|
|
return err
|
|
}
|