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_anchors.sql
package store
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const advanceRoomDocumentCommentThreadAnchor = `-- name: AdvanceRoomDocumentCommentThreadAnchor :exec
UPDATE room_document_comment_threads
SET current_anchor_id=$1::text,anchor_kind='selection',
anchor_document_version_id=NULL,anchor_quoted_text=$2::text,
anchor_block_id=$3::text,anchor_context_before=$4::text,
anchor_context_after=$5::text,anchor_version_number=anchor_version_number+1,
anchor_created_by_actor_id=$6::text,anchor_created_at=now(),
anchor_status='pending',updated_at=now()
WHERE id=$7::text
`
type AdvanceRoomDocumentCommentThreadAnchorParams struct {
AnchorID string `json:"anchor_id"`
QuotedText string `json:"quoted_text"`
BlockID string `json:"block_id"`
ContextBefore string `json:"context_before"`
ContextAfter string `json:"context_after"`
ActorID string `json:"actor_id"`
ThreadID string `json:"thread_id"`
}
func (q *Queries) AdvanceRoomDocumentCommentThreadAnchor(ctx context.Context, arg AdvanceRoomDocumentCommentThreadAnchorParams) error {
_, err := q.db.Exec(ctx, advanceRoomDocumentCommentThreadAnchor,
arg.AnchorID,
arg.QuotedText,
arg.BlockID,
arg.ContextBefore,
arg.ContextAfter,
arg.ActorID,
arg.ThreadID,
)
return err
}
const getRoomDocumentCommentReanchorAuthority = `-- name: GetRoomDocumentCommentReanchorAuthority :one
SELECT thread.id AS thread_id,thread.document_id,thread.tenant_id,thread.room_id,
thread.anchor_status,thread.resolved_at,
caller.id AS actor_id,caller.kind AS actor_kind,
caller.display_name AS actor_display_name
FROM room_document_comment_threads thread
JOIN documents document
ON document.id=thread.document_id AND document.tenant_id=thread.tenant_id
AND document.status='active'
JOIN actors caller
ON caller.tenant_id=thread.tenant_id
AND caller.account_id=$1::text
AND caller.kind='human'
WHERE thread.id=$2::text
AND EXISTS(SELECT 1 FROM resolve_human_document_access_v2(
$1::text,thread.document_id
) access
WHERE access.tenant_id=thread.tenant_id AND access.can_read)
FOR UPDATE OF thread
`
type GetRoomDocumentCommentReanchorAuthorityParams struct {
AccountID string `json:"account_id"`
ThreadID string `json:"thread_id"`
}
type GetRoomDocumentCommentReanchorAuthorityRow struct {
ThreadID string `json:"thread_id"`
DocumentID string `json:"document_id"`
TenantID string `json:"tenant_id"`
RoomID pgtype.Text `json:"room_id"`
AnchorStatus string `json:"anchor_status"`
ResolvedAt pgtype.Timestamptz `json:"resolved_at"`
ActorID string `json:"actor_id"`
ActorKind string `json:"actor_kind"`
ActorDisplayName string `json:"actor_display_name"`
}
func (q *Queries) GetRoomDocumentCommentReanchorAuthority(ctx context.Context, arg GetRoomDocumentCommentReanchorAuthorityParams) (GetRoomDocumentCommentReanchorAuthorityRow, error) {
row := q.db.QueryRow(ctx, getRoomDocumentCommentReanchorAuthority, arg.AccountID, arg.ThreadID)
var i GetRoomDocumentCommentReanchorAuthorityRow
err := row.Scan(
&i.ThreadID,
&i.DocumentID,
&i.TenantID,
&i.RoomID,
&i.AnchorStatus,
&i.ResolvedAt,
&i.ActorID,
&i.ActorKind,
&i.ActorDisplayName,
)
return i, err
}