mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
- Add sqlc.yaml config (SQLite engine, db/queries/sqlite/, db/dbgen/ output) - Pin sqlc v1.30.0 in sqlc.version - Add Makefile with sqlc-install, sqlc-generate, sqlc-verify targets - Write 14 SQL query files covering all DB domains (users, sessions, invites, channels, messages, reactions, voice, roles, attachments, admin, dm, blocks, lockouts, profile) - Commit generated db/dbgen/ package (querier interface + typed fns) - FTS5 search queries remain hand-written in message_queries.go; transactional multi-step operations unchanged in Go
81 lines
2.0 KiB
Go
81 lines
2.0 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: blocks.sql
|
|
|
|
package dbgen
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const blockUser = `-- name: BlockUser :exec
|
|
INSERT OR IGNORE INTO user_blocks (blocker_id, blocked_id) VALUES (?, ?)
|
|
`
|
|
|
|
type BlockUserParams struct {
|
|
BlockerID int64 `json:"blockerId"`
|
|
BlockedID int64 `json:"blockedId"`
|
|
}
|
|
|
|
func (q *Queries) BlockUser(ctx context.Context, arg BlockUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, blockUser, arg.BlockerID, arg.BlockedID)
|
|
return err
|
|
}
|
|
|
|
const isBlocked = `-- name: IsBlocked :one
|
|
SELECT 1 FROM user_blocks WHERE blocker_id = ? AND blocked_id = ? LIMIT 1
|
|
`
|
|
|
|
type IsBlockedParams struct {
|
|
BlockerID int64 `json:"blockerId"`
|
|
BlockedID int64 `json:"blockedId"`
|
|
}
|
|
|
|
func (q *Queries) IsBlocked(ctx context.Context, arg IsBlockedParams) (int64, error) {
|
|
row := q.db.QueryRowContext(ctx, isBlocked, arg.BlockerID, arg.BlockedID)
|
|
var column_1 int64
|
|
err := row.Scan(&column_1)
|
|
return column_1, err
|
|
}
|
|
|
|
const isEitherBlocked = `-- name: IsEitherBlocked :one
|
|
SELECT 1 FROM user_blocks
|
|
WHERE (blocker_id = ? AND blocked_id = ?)
|
|
OR (blocker_id = ? AND blocked_id = ?)
|
|
LIMIT 1
|
|
`
|
|
|
|
type IsEitherBlockedParams struct {
|
|
BlockerID int64 `json:"blockerId"`
|
|
BlockedID int64 `json:"blockedId"`
|
|
BlockerID_2 int64 `json:"blockerId2"`
|
|
BlockedID_2 int64 `json:"blockedId2"`
|
|
}
|
|
|
|
func (q *Queries) IsEitherBlocked(ctx context.Context, arg IsEitherBlockedParams) (int64, error) {
|
|
row := q.db.QueryRowContext(ctx, isEitherBlocked,
|
|
arg.BlockerID,
|
|
arg.BlockedID,
|
|
arg.BlockerID_2,
|
|
arg.BlockedID_2,
|
|
)
|
|
var column_1 int64
|
|
err := row.Scan(&column_1)
|
|
return column_1, err
|
|
}
|
|
|
|
const unblockUser = `-- name: UnblockUser :exec
|
|
DELETE FROM user_blocks WHERE blocker_id = ? AND blocked_id = ?
|
|
`
|
|
|
|
type UnblockUserParams struct {
|
|
BlockerID int64 `json:"blockerId"`
|
|
BlockedID int64 `json:"blockedId"`
|
|
}
|
|
|
|
func (q *Queries) UnblockUser(ctx context.Context, arg UnblockUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, unblockUser, arg.BlockerID, arg.BlockedID)
|
|
return err
|
|
}
|