mirror of
https://github.com/lightninglabs/aperture.git
synced 2025-12-18 01:24:19 +01:00
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.18.0
|
|
// source: onion.sql
|
|
|
|
package sqlc
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
const deleteOnionPrivateKey = `-- name: DeleteOnionPrivateKey :exec
|
|
DELETE FROM onion
|
|
`
|
|
|
|
func (q *Queries) DeleteOnionPrivateKey(ctx context.Context) error {
|
|
_, err := q.db.ExecContext(ctx, deleteOnionPrivateKey)
|
|
return err
|
|
}
|
|
|
|
const selectOnionPrivateKey = `-- name: SelectOnionPrivateKey :one
|
|
SELECT private_key
|
|
FROM onion
|
|
LIMIT 1
|
|
`
|
|
|
|
func (q *Queries) SelectOnionPrivateKey(ctx context.Context) ([]byte, error) {
|
|
row := q.db.QueryRowContext(ctx, selectOnionPrivateKey)
|
|
var private_key []byte
|
|
err := row.Scan(&private_key)
|
|
return private_key, err
|
|
}
|
|
|
|
const upsertOnion = `-- name: UpsertOnion :exec
|
|
INSERT INTO onion (
|
|
private_key, created_at
|
|
) VALUES (
|
|
$1, $2
|
|
) ON CONFLICT (
|
|
private_key
|
|
) DO NOTHING
|
|
`
|
|
|
|
type UpsertOnionParams struct {
|
|
PrivateKey []byte
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
func (q *Queries) UpsertOnion(ctx context.Context, arg UpsertOnionParams) error {
|
|
_, err := q.db.ExecContext(ctx, upsertOnion, arg.PrivateKey, arg.CreatedAt)
|
|
return err
|
|
}
|