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: voice_capture_questions.sql
package store
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const createVoiceCaptureQuestion = `-- name: CreateVoiceCaptureQuestion :one
INSERT INTO voice_capture_questions(id,capture_session_id,kind,question,answer,answered,cutoff_offset_ms,sources,task_title)
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9)
RETURNING id, capture_session_id, question, answer, answered, cutoff_offset_ms, sources, created_at, kind, task_title, sent_message_id
`
type CreateVoiceCaptureQuestionParams struct {
ID string `json:"id"`
CaptureSessionID string `json:"capture_session_id"`
Kind string `json:"kind"`
Question string `json:"question"`
Answer string `json:"answer"`
Answered bool `json:"answered"`
CutoffOffsetMs int64 `json:"cutoff_offset_ms"`
Sources []byte `json:"sources"`
TaskTitle string `json:"task_title"`
}
func (q *Queries) CreateVoiceCaptureQuestion(ctx context.Context, arg CreateVoiceCaptureQuestionParams) (VoiceCaptureQuestion, error) {
row := q.db.QueryRow(ctx, createVoiceCaptureQuestion,
arg.ID,
arg.CaptureSessionID,
arg.Kind,
arg.Question,
arg.Answer,
arg.Answered,
arg.CutoffOffsetMs,
arg.Sources,
arg.TaskTitle,
)
var i VoiceCaptureQuestion
err := row.Scan(
&i.ID,
&i.CaptureSessionID,
&i.Question,
&i.Answer,
&i.Answered,
&i.CutoffOffsetMs,
&i.Sources,
&i.CreatedAt,
&i.Kind,
&i.TaskTitle,
&i.SentMessageID,
)
return i, err
}
const getOwnedLiveKitCaptureForAccount = `-- name: GetOwnedLiveKitCaptureForAccount :one
SELECT capture.id,capture.voice_session_id,capture.tenant_id,capture.created_by_actor_id
FROM capture_sessions capture
JOIN actors caller
ON caller.id=capture.created_by_actor_id AND caller.account_id=$1::text AND caller.kind='human'
JOIN active_room_members member ON member.actor_id=caller.id AND member.room_id=capture.room_id
JOIN rooms room ON room.id=capture.room_id AND room.deleted_at IS NULL
WHERE capture.id=$2::text
AND capture.voice_session_id IS NOT NULL
`
type GetOwnedLiveKitCaptureForAccountParams struct {
AccountID string `json:"account_id"`
CaptureID string `json:"capture_id"`
}
type GetOwnedLiveKitCaptureForAccountRow struct {
ID string `json:"id"`
VoiceSessionID pgtype.Text `json:"voice_session_id"`
TenantID string `json:"tenant_id"`
CreatedByActorID string `json:"created_by_actor_id"`
}
// Recording questions are private to the person who recorded.
func (q *Queries) GetOwnedLiveKitCaptureForAccount(ctx context.Context, arg GetOwnedLiveKitCaptureForAccountParams) (GetOwnedLiveKitCaptureForAccountRow, error) {
row := q.db.QueryRow(ctx, getOwnedLiveKitCaptureForAccount, arg.AccountID, arg.CaptureID)
var i GetOwnedLiveKitCaptureForAccountRow
err := row.Scan(
&i.ID,
&i.VoiceSessionID,
&i.TenantID,
&i.CreatedByActorID,
)
return i, err
}
const getVoiceCaptureQuestion = `-- name: GetVoiceCaptureQuestion :one
SELECT id, capture_session_id, question, answer, answered, cutoff_offset_ms, sources, created_at, kind, task_title, sent_message_id FROM voice_capture_questions
WHERE capture_session_id=$1::text AND id=$2::text
`
type GetVoiceCaptureQuestionParams struct {
CaptureSessionID string `json:"capture_session_id"`
ID string `json:"id"`
}
func (q *Queries) GetVoiceCaptureQuestion(ctx context.Context, arg GetVoiceCaptureQuestionParams) (VoiceCaptureQuestion, error) {
row := q.db.QueryRow(ctx, getVoiceCaptureQuestion, arg.CaptureSessionID, arg.ID)
var i VoiceCaptureQuestion
err := row.Scan(
&i.ID,
&i.CaptureSessionID,
&i.Question,
&i.Answer,
&i.Answered,
&i.CutoffOffsetMs,
&i.Sources,
&i.CreatedAt,
&i.Kind,
&i.TaskTitle,
&i.SentMessageID,
)
return i, err
}
const listConfirmedVoiceCaptureSpeech = `-- name: ListConfirmedVoiceCaptureSpeech :many
SELECT segment.start_offset_ms,segment.end_offset_ms,segment.text,segment.speaker_id
FROM capture_sessions capture
JOIN voice_transcript_segments segment
ON segment.voice_session_id=capture.voice_session_id AND segment.capture_session_id=capture.id
WHERE capture.id=$1::text
AND segment.lane='live' AND segment.kind='speech'
ORDER BY segment.start_offset_ms,segment.end_offset_ms,segment.id
`
type ListConfirmedVoiceCaptureSpeechRow struct {
StartOffsetMs int64 `json:"start_offset_ms"`
EndOffsetMs int64 `json:"end_offset_ms"`
Text string `json:"text"`
SpeakerID pgtype.Text `json:"speaker_id"`
}
// Confirmed live speech of one recording, read through the VoiceSession
// timeline index.
func (q *Queries) ListConfirmedVoiceCaptureSpeech(ctx context.Context, captureID string) ([]ListConfirmedVoiceCaptureSpeechRow, error) {
rows, err := q.db.Query(ctx, listConfirmedVoiceCaptureSpeech, captureID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []ListConfirmedVoiceCaptureSpeechRow{}
for rows.Next() {
var i ListConfirmedVoiceCaptureSpeechRow
if err := rows.Scan(
&i.StartOffsetMs,
&i.EndOffsetMs,
&i.Text,
&i.SpeakerID,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listVoiceCaptureQuestions = `-- name: ListVoiceCaptureQuestions :many
SELECT id, capture_session_id, question, answer, answered, cutoff_offset_ms, sources, created_at, kind, task_title, sent_message_id FROM voice_capture_questions
WHERE capture_session_id=$1
ORDER BY created_at,id
`
func (q *Queries) ListVoiceCaptureQuestions(ctx context.Context, captureSessionID string) ([]VoiceCaptureQuestion, error) {
rows, err := q.db.Query(ctx, listVoiceCaptureQuestions, captureSessionID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []VoiceCaptureQuestion{}
for rows.Next() {
var i VoiceCaptureQuestion
if err := rows.Scan(
&i.ID,
&i.CaptureSessionID,
&i.Question,
&i.Answer,
&i.Answered,
&i.CutoffOffsetMs,
&i.Sources,
&i.CreatedAt,
&i.Kind,
&i.TaskTitle,
&i.SentMessageID,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const recordVoiceCaptureQuestionSent = `-- name: RecordVoiceCaptureQuestionSent :one
WITH sent AS (
UPDATE voice_capture_questions
SET sent_message_id=$1::text
WHERE id=$2::text AND kind='task' AND sent_message_id IS NULL
RETURNING id, capture_session_id, question, answer, answered, cutoff_offset_ms, sources, created_at, kind, task_title, sent_message_id
), changed_capture AS (
UPDATE capture_sessions capture SET updated_at=clock_timestamp()
FROM sent WHERE capture.id=sent.capture_session_id
RETURNING capture.id
)
SELECT sent.id, sent.capture_session_id, sent.question, sent.answer, sent.answered, sent.cutoff_offset_ms, sent.sources, sent.created_at, sent.kind, sent.task_title, sent.sent_message_id FROM sent JOIN changed_capture ON changed_capture.id=sent.capture_session_id
`
type RecordVoiceCaptureQuestionSentParams struct {
SentMessageID string `json:"sent_message_id"`
ID string `json:"id"`
}
type RecordVoiceCaptureQuestionSentRow struct {
ID string `json:"id"`
CaptureSessionID string `json:"capture_session_id"`
Question string `json:"question"`
Answer string `json:"answer"`
Answered bool `json:"answered"`
CutoffOffsetMs int64 `json:"cutoff_offset_ms"`
Sources []byte `json:"sources"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
Kind string `json:"kind"`
TaskTitle string `json:"task_title"`
SentMessageID pgtype.Text `json:"sent_message_id"`
}
// A task request is handed to Another Me at most once.
func (q *Queries) RecordVoiceCaptureQuestionSent(ctx context.Context, arg RecordVoiceCaptureQuestionSentParams) (RecordVoiceCaptureQuestionSentRow, error) {
row := q.db.QueryRow(ctx, recordVoiceCaptureQuestionSent, arg.SentMessageID, arg.ID)
var i RecordVoiceCaptureQuestionSentRow
err := row.Scan(
&i.ID,
&i.CaptureSessionID,
&i.Question,
&i.Answer,
&i.Answered,
&i.CutoffOffsetMs,
&i.Sources,
&i.CreatedAt,
&i.Kind,
&i.TaskTitle,
&i.SentMessageID,
)
return i, err
}