Files
aperture/aperturedb/sqlc/lnc_sessions.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

100 lines
2.3 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: lnc_sessions.sql
package sqlc
import (
"context"
"database/sql"
"time"
)
const getSession = `-- name: GetSession :one
SELECT id, passphrase_words, passphrase_entropy, remote_static_pub_key, local_static_priv_key, mailbox_addr, created_at, expiry, dev_server
FROM lnc_sessions
WHERE passphrase_entropy = $1
`
func (q *Queries) GetSession(ctx context.Context, passphraseEntropy []byte) (LncSession, error) {
row := q.db.QueryRowContext(ctx, getSession, passphraseEntropy)
var i LncSession
err := row.Scan(
&i.ID,
&i.PassphraseWords,
&i.PassphraseEntropy,
&i.RemoteStaticPubKey,
&i.LocalStaticPrivKey,
&i.MailboxAddr,
&i.CreatedAt,
&i.Expiry,
&i.DevServer,
)
return i, err
}
const insertSession = `-- name: InsertSession :exec
INSERT INTO lnc_sessions (
passphrase_words, passphrase_entropy, local_static_priv_key, mailbox_addr,
created_at, expiry, dev_server
) VALUES (
$1, $2, $3, $4, $5, $6, $7
)
`
type InsertSessionParams struct {
PassphraseWords string
PassphraseEntropy []byte
LocalStaticPrivKey []byte
MailboxAddr string
CreatedAt time.Time
Expiry sql.NullTime
DevServer bool
}
func (q *Queries) InsertSession(ctx context.Context, arg InsertSessionParams) error {
_, err := q.db.ExecContext(ctx, insertSession,
arg.PassphraseWords,
arg.PassphraseEntropy,
arg.LocalStaticPrivKey,
arg.MailboxAddr,
arg.CreatedAt,
arg.Expiry,
arg.DevServer,
)
return err
}
const setExpiry = `-- name: SetExpiry :exec
UPDATE lnc_sessions
SET expiry=$1
WHERE passphrase_entropy=$2
`
type SetExpiryParams struct {
Expiry sql.NullTime
PassphraseEntropy []byte
}
func (q *Queries) SetExpiry(ctx context.Context, arg SetExpiryParams) error {
_, err := q.db.ExecContext(ctx, setExpiry, arg.Expiry, arg.PassphraseEntropy)
return err
}
const setRemotePubKey = `-- name: SetRemotePubKey :exec
UPDATE lnc_sessions
SET remote_static_pub_key=$1
WHERE passphrase_entropy=$2
`
type SetRemotePubKeyParams struct {
RemoteStaticPubKey []byte
PassphraseEntropy []byte
}
func (q *Queries) SetRemotePubKey(ctx context.Context, arg SetRemotePubKeyParams) error {
_, err := q.db.ExecContext(ctx, setRemotePubKey, arg.RemoteStaticPubKey, arg.PassphraseEntropy)
return err
}