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_team_document.sql
package store
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getRoomTeamDocument = `-- name: GetRoomTeamDocument :one
SELECT team_md_raw_markdown::text AS raw_markdown,
team_md_collaborate_pattern::text AS collaborate_pattern,
team_md_document::jsonb AS document,
team_md_revision::bigint AS revision,
team_md_updated_at::timestamptz AS updated_at
FROM rooms
WHERE id=$1::text
AND tenant_id=$2::text
AND deleted_at IS NULL
AND team_md_revision IS NOT NULL
`
type GetRoomTeamDocumentParams struct {
RoomID string `json:"room_id"`
TenantID string `json:"tenant_id"`
}
type GetRoomTeamDocumentRow struct {
RawMarkdown string `json:"raw_markdown"`
CollaboratePattern string `json:"collaborate_pattern"`
Document []byte `json:"document"`
Revision int64 `json:"revision"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
func (q *Queries) GetRoomTeamDocument(ctx context.Context, arg GetRoomTeamDocumentParams) (GetRoomTeamDocumentRow, error) {
row := q.db.QueryRow(ctx, getRoomTeamDocument, arg.RoomID, arg.TenantID)
var i GetRoomTeamDocumentRow
err := row.Scan(
&i.RawMarkdown,
&i.CollaboratePattern,
&i.Document,
&i.Revision,
&i.UpdatedAt,
)
return i, err
}
const markMessageTeamProtocol = `-- name: MarkMessageTeamProtocol :exec
UPDATE messages
SET team_protocol=$1::text
WHERE id=$2::text
AND tenant_id=$3::text
`
type MarkMessageTeamProtocolParams struct {
CollaboratePattern string `json:"collaborate_pattern"`
MessageID string `json:"message_id"`
TenantID string `json:"tenant_id"`
}
func (q *Queries) MarkMessageTeamProtocol(ctx context.Context, arg MarkMessageTeamProtocolParams) error {
_, err := q.db.Exec(ctx, markMessageTeamProtocol, arg.CollaboratePattern, arg.MessageID, arg.TenantID)
return err
}
const upsertRoomTeamDocument = `-- name: UpsertRoomTeamDocument :one
UPDATE rooms
SET team_md_raw_markdown=$1::text,
team_md_collaborate_pattern=$2::text,
team_md_document=$3::jsonb,
team_md_revision=coalesce(team_md_revision,0)+1,
team_md_updated_by_actor_id=$4::text,
team_md_updated_at=now()
WHERE id=$5::text
AND tenant_id=$6::text
RETURNING team_md_revision::bigint AS revision,
team_md_updated_at::timestamptz AS updated_at
`
type UpsertRoomTeamDocumentParams struct {
RawMarkdown string `json:"raw_markdown"`
CollaboratePattern string `json:"collaborate_pattern"`
Document []byte `json:"document"`
UpdatedByActorID string `json:"updated_by_actor_id"`
RoomID string `json:"room_id"`
TenantID string `json:"tenant_id"`
}
type UpsertRoomTeamDocumentRow struct {
Revision int64 `json:"revision"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
// The first team.md write is revision 1; each later write adds one. Writers
// serialize on the Room row.
func (q *Queries) UpsertRoomTeamDocument(ctx context.Context, arg UpsertRoomTeamDocumentParams) (UpsertRoomTeamDocumentRow, error) {
row := q.db.QueryRow(ctx, upsertRoomTeamDocument,
arg.RawMarkdown,
arg.CollaboratePattern,
arg.Document,
arg.UpdatedByActorID,
arg.RoomID,
arg.TenantID,
)
var i UpsertRoomTeamDocumentRow
err := row.Scan(&i.Revision, &i.UpdatedAt)
return i, err
}