Files
aperture/aperturedb/sqlc/secrets.sql.go
Jordi Montes c0353f07dd sqlc: bump version to v1.25.0
Since v0.18.0 there they multiple bug fixes, support more postgres/sqlite
features, etc...

Nothing impacting the current code.

NOTE: It also looks like sqlc is growing as a company and wants to support
more languages, add feature for cloud clients, etc... Because of the
open source nature of this project I do not think that brings any extra
benefit. The only remarkable thing is that they are working on doing the
code more modular, and extracting the code generation in multiple "plugins"
They already extracted the go one. No changes are needed by now, but maybe
at some point they delete the code gen form the main project and the config
files need to be updated to use the plugin system [sqlc-dev/plugin-sdk-go].
2024-02-13 11:28:53 -08:00

59 lines
1.2 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: secrets.sql
package sqlc
import (
"context"
"time"
)
const deleteSecretByHash = `-- name: DeleteSecretByHash :execrows
DELETE FROM secrets
WHERE hash = $1
`
func (q *Queries) DeleteSecretByHash(ctx context.Context, hash []byte) (int64, error) {
result, err := q.db.ExecContext(ctx, deleteSecretByHash, hash)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
const getSecretByHash = `-- name: GetSecretByHash :one
SELECT secret
FROM secrets
WHERE hash = $1
`
func (q *Queries) GetSecretByHash(ctx context.Context, hash []byte) ([]byte, error) {
row := q.db.QueryRowContext(ctx, getSecretByHash, hash)
var secret []byte
err := row.Scan(&secret)
return secret, err
}
const insertSecret = `-- name: InsertSecret :one
INSERT INTO secrets (
hash, secret, created_at
) VALUES (
$1, $2, $3
) RETURNING id
`
type InsertSecretParams struct {
Hash []byte
Secret []byte
CreatedAt time.Time
}
func (q *Queries) InsertSecret(ctx context.Context, arg InsertSecretParams) (int32, error) {
row := q.db.QueryRowContext(ctx, insertSecret, arg.Hash, arg.Secret, arg.CreatedAt)
var id int32
err := row.Scan(&id)
return id, err
}