matrix-bridge-meshtastic/db/matrix_sync.sql.go

60 lines
1.7 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.20.0
// source: matrix_sync.sql
package db
import (
"context"
)
const matrixLoadFilterID = `-- name: MatrixLoadFilterID :one
SELECT filter_id FROM matrix_filters WHERE user_id = ?
`
func (q *Queries) MatrixLoadFilterID(ctx context.Context, userID string) (string, error) {
row := q.db.QueryRowContext(ctx, matrixLoadFilterID, userID)
var filter_id string
err := row.Scan(&filter_id)
return filter_id, err
}
const matrixLoadNextBatch = `-- name: MatrixLoadNextBatch :one
SELECT token FROM matrix_next_batch WHERE user_id = ?
`
func (q *Queries) MatrixLoadNextBatch(ctx context.Context, userID string) (string, error) {
row := q.db.QueryRowContext(ctx, matrixLoadNextBatch, userID)
var token string
err := row.Scan(&token)
return token, err
}
const matrixSaveFilterID = `-- name: MatrixSaveFilterID :exec
INSERT INTO matrix_filters (user_id, filter_id) VALUES (?, ?) ON CONFLICT (user_id) DO UPDATE SET filter_id = excluded.filter_id
`
type MatrixSaveFilterIDParams struct {
UserID string
FilterID string
}
func (q *Queries) MatrixSaveFilterID(ctx context.Context, arg MatrixSaveFilterIDParams) error {
_, err := q.db.ExecContext(ctx, matrixSaveFilterID, arg.UserID, arg.FilterID)
return err
}
const matrixSaveNextBatch = `-- name: MatrixSaveNextBatch :exec
INSERT INTO matrix_next_batch (user_id, token) VALUES (?, ?) ON CONFLICT (user_id) DO UPDATE SET token = excluded.token
`
type MatrixSaveNextBatchParams struct {
UserID string
Token string
}
func (q *Queries) MatrixSaveNextBatch(ctx context.Context, arg MatrixSaveNextBatchParams) error {
_, err := q.db.ExecContext(ctx, matrixSaveNextBatch, arg.UserID, arg.Token)
return err
}