Skip to content

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.

2.3 KB
Raw Blame
// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.29.0
// source: room_agent.sql

package store

import (
	"context"

	"github.com/jackc/pgx/v5/pgtype"
)

const getRoomAgentMessageAuthority = `-- name: GetRoomAgentMessageAuthority :one
SELECT room.id AS room_id,room.tenant_id,
       actor.id AS agent_id,actor.kind AS agent_kind,actor.display_name AS agent_display_name,
       actor.account_id AS agent_account_id,actor.handle AS agent_handle,actor.created_at AS agent_created_at,
       registration.created_by_actor_id AS agent_sponsor_actor_id
FROM rooms room
JOIN room_members membership
  ON membership.room_id=collaboration_membership_room_id(room.id)
 AND membership.tenant_id=room.tenant_id
JOIN actors actor
  ON actor.id=membership.actor_id
 AND actor.tenant_id=membership.tenant_id
 AND actor.kind='agent'
JOIN agent_registrations registration
  ON registration.actor_id=actor.id
 AND registration.tenant_id=actor.tenant_id
 AND registration.status='active'
WHERE room.id=$1::text
  AND registration.agent_management_id=$2::text
FOR KEY SHARE OF room,membership,actor,registration
`

type GetRoomAgentMessageAuthorityParams struct {
	RoomID            string `json:"room_id"`
	AgentManagementID string `json:"agent_management_id"`
}

type GetRoomAgentMessageAuthorityRow struct {
	RoomID              string             `json:"room_id"`
	TenantID            string             `json:"tenant_id"`
	AgentID             string             `json:"agent_id"`
	AgentKind           string             `json:"agent_kind"`
	AgentDisplayName    string             `json:"agent_display_name"`
	AgentAccountID      pgtype.Text        `json:"agent_account_id"`
	AgentHandle         pgtype.Text        `json:"agent_handle"`
	AgentCreatedAt      pgtype.Timestamptz `json:"agent_created_at"`
	AgentSponsorActorID string             `json:"agent_sponsor_actor_id"`
}

func (q *Queries) GetRoomAgentMessageAuthority(ctx context.Context, arg GetRoomAgentMessageAuthorityParams) (GetRoomAgentMessageAuthorityRow, error) {
	row := q.db.QueryRow(ctx, getRoomAgentMessageAuthority, arg.RoomID, arg.AgentManagementID)
	var i GetRoomAgentMessageAuthorityRow
	err := row.Scan(
		&i.RoomID,
		&i.TenantID,
		&i.AgentID,
		&i.AgentKind,
		&i.AgentDisplayName,
		&i.AgentAccountID,
		&i.AgentHandle,
		&i.AgentCreatedAt,
		&i.AgentSponsorActorID,
	)
	return i, err
}