Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: room_document_comment_reactions.sql
package store
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const countRoomDocumentCommentReactions = `-- name: CountRoomDocumentCommentReactions :one
SELECT count(*)
FROM room_document_comment_reactions
WHERE comment_id=$1::text
`
func (q *Queries) CountRoomDocumentCommentReactions(ctx context.Context, commentID string) (int64, error) {
row := q.db.QueryRow(ctx, countRoomDocumentCommentReactions, commentID)
var count int64
err := row.Scan(&count)
return count, err
}
const deleteRoomDocumentCommentReaction = `-- name: DeleteRoomDocumentCommentReaction :execrows
DELETE FROM room_document_comment_reactions
WHERE comment_id=$1::text
AND actor_id=$2::text
AND emoji=$3::text
`
type DeleteRoomDocumentCommentReactionParams struct {
CommentID string `json:"comment_id"`
ActorID string `json:"actor_id"`
Emoji string `json:"emoji"`
}
func (q *Queries) DeleteRoomDocumentCommentReaction(ctx context.Context, arg DeleteRoomDocumentCommentReactionParams) (int64, error) {
result, err := q.db.Exec(ctx, deleteRoomDocumentCommentReaction, arg.CommentID, arg.ActorID, arg.Emoji)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
const getRoomDocumentCommentReactionAuthority = `-- name: GetRoomDocumentCommentReactionAuthority :one
SELECT comment.id AS comment_id,comment.thread_id,comment.document_id,
comment.tenant_id,comment.room_id,caller.id AS actor_id
FROM room_document_comments comment
JOIN room_document_comment_threads thread ON thread.id=comment.thread_id
JOIN documents document
ON document.id=comment.document_id AND document.tenant_id=comment.tenant_id
AND document.status='active'
JOIN actors caller
ON caller.tenant_id=comment.tenant_id
AND caller.account_id=$1::text
AND caller.kind='human'
WHERE comment.id=$2::text
AND comment.deleted_at IS NULL
AND thread.anchor_status<>'orphaned'
AND EXISTS(SELECT 1 FROM resolve_human_document_access_v2(
$1::text,comment.document_id
) access
WHERE access.tenant_id=comment.tenant_id AND access.can_read)
FOR UPDATE OF thread,comment
`
type GetRoomDocumentCommentReactionAuthorityParams struct {
AccountID string `json:"account_id"`
CommentID string `json:"comment_id"`
}
type GetRoomDocumentCommentReactionAuthorityRow struct {
CommentID string `json:"comment_id"`
ThreadID string `json:"thread_id"`
DocumentID string `json:"document_id"`
TenantID string `json:"tenant_id"`
RoomID pgtype.Text `json:"room_id"`
ActorID string `json:"actor_id"`
}
func (q *Queries) GetRoomDocumentCommentReactionAuthority(ctx context.Context, arg GetRoomDocumentCommentReactionAuthorityParams) (GetRoomDocumentCommentReactionAuthorityRow, error) {
row := q.db.QueryRow(ctx, getRoomDocumentCommentReactionAuthority, arg.AccountID, arg.CommentID)
var i GetRoomDocumentCommentReactionAuthorityRow
err := row.Scan(
&i.CommentID,
&i.ThreadID,
&i.DocumentID,
&i.TenantID,
&i.RoomID,
&i.ActorID,
)
return i, err
}
const listRoomDocumentCommentReactionsForThreads = `-- name: ListRoomDocumentCommentReactionsForThreads :many
SELECT comment_id,emoji,actor_id,created_at
FROM room_document_comment_reactions
WHERE thread_id=ANY($1::text[])
ORDER BY comment_id,emoji,actor_id
`
type ListRoomDocumentCommentReactionsForThreadsRow struct {
CommentID string `json:"comment_id"`
Emoji string `json:"emoji"`
ActorID string `json:"actor_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
func (q *Queries) ListRoomDocumentCommentReactionsForThreads(ctx context.Context, threadIds []string) ([]ListRoomDocumentCommentReactionsForThreadsRow, error) {
rows, err := q.db.Query(ctx, listRoomDocumentCommentReactionsForThreads, threadIds)
if err != nil {
return nil, err
}
defer rows.Close()
items := []ListRoomDocumentCommentReactionsForThreadsRow{}
for rows.Next() {
var i ListRoomDocumentCommentReactionsForThreadsRow
if err := rows.Scan(
&i.CommentID,
&i.Emoji,
&i.ActorID,
&i.CreatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const putRoomDocumentCommentReaction = `-- name: PutRoomDocumentCommentReaction :execrows
INSERT INTO room_document_comment_reactions(
tenant_id,room_id,document_id,thread_id,comment_id,actor_id,emoji
) VALUES(
$1::text,NULLIF($2::text,''),
$3::text,$4::text,
$5::text,$6::text,$7::text
)
ON CONFLICT (comment_id,actor_id,emoji) DO NOTHING
`
type PutRoomDocumentCommentReactionParams struct {
TenantID string `json:"tenant_id"`
RoomID string `json:"room_id"`
DocumentID string `json:"document_id"`
ThreadID string `json:"thread_id"`
CommentID string `json:"comment_id"`
ActorID string `json:"actor_id"`
Emoji string `json:"emoji"`
}
func (q *Queries) PutRoomDocumentCommentReaction(ctx context.Context, arg PutRoomDocumentCommentReactionParams) (int64, error) {
result, err := q.db.Exec(ctx, putRoomDocumentCommentReaction,
arg.TenantID,
arg.RoomID,
arg.DocumentID,
arg.ThreadID,
arg.CommentID,
arg.ActorID,
arg.Emoji,
)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
const roomDocumentCommentReactionExists = `-- name: RoomDocumentCommentReactionExists :one
SELECT EXISTS(
SELECT 1
FROM room_document_comment_reactions
WHERE comment_id=$1::text
AND actor_id=$2::text
AND emoji=$3::text
)
`
type RoomDocumentCommentReactionExistsParams struct {
CommentID string `json:"comment_id"`
ActorID string `json:"actor_id"`
Emoji string `json:"emoji"`
}
func (q *Queries) RoomDocumentCommentReactionExists(ctx context.Context, arg RoomDocumentCommentReactionExistsParams) (bool, error) {
row := q.db.QueryRow(ctx, roomDocumentCommentReactionExists, arg.CommentID, arg.ActorID, arg.Emoji)
var exists bool
err := row.Scan(&exists)
return exists, err
}