(ctx context.Context, arg CountAIBridgeSessionsParams, prepared rbac.PreparedAuthorized)
| 1147 | } |
| 1148 | |
| 1149 | func (q *sqlQuerier) CountAuthorizedAIBridgeSessions(ctx context.Context, arg CountAIBridgeSessionsParams, prepared rbac.PreparedAuthorized) (int64, error) { |
| 1150 | authorizedFilter, err := prepared.CompileToSQL(ctx, regosql.ConvertConfig{ |
| 1151 | VariableConverter: regosql.AIBridgeInterceptionConverter(), |
| 1152 | }) |
| 1153 | if err != nil { |
| 1154 | return 0, xerrors.Errorf("compile authorized filter: %w", err) |
| 1155 | } |
| 1156 | filtered, err := insertAuthorizedFilter(countAIBridgeSessions, fmt.Sprintf(" AND %s", authorizedFilter)) |
| 1157 | if err != nil { |
| 1158 | return 0, xerrors.Errorf("insert authorized filter: %w", err) |
| 1159 | } |
| 1160 | |
| 1161 | query := fmt.Sprintf("-- name: CountAuthorizedAIBridgeSessions :one\n%s", filtered) |
| 1162 | rows, err := q.db.QueryContext(ctx, query, |
| 1163 | arg.StartedAfter, |
| 1164 | arg.StartedBefore, |
| 1165 | arg.InitiatorID, |
| 1166 | arg.Provider, |
| 1167 | arg.ProviderName, |
| 1168 | arg.Model, |
| 1169 | arg.Client, |
| 1170 | arg.SessionID, |
| 1171 | ) |
| 1172 | if err != nil { |
| 1173 | return 0, err |
| 1174 | } |
| 1175 | defer rows.Close() |
| 1176 | var count int64 |
| 1177 | for rows.Next() { |
| 1178 | if err := rows.Scan(&count); err != nil { |
| 1179 | return 0, err |
| 1180 | } |
| 1181 | } |
| 1182 | if err := rows.Close(); err != nil { |
| 1183 | return 0, err |
| 1184 | } |
| 1185 | if err := rows.Err(); err != nil { |
| 1186 | return 0, err |
| 1187 | } |
| 1188 | return count, nil |
| 1189 | } |
| 1190 | |
| 1191 | func (q *sqlQuerier) ListAuthorizedAIBridgeSessionThreads(ctx context.Context, arg ListAIBridgeSessionThreadsParams, prepared rbac.PreparedAuthorized) ([]ListAIBridgeSessionThreadsRow, error) { |
| 1192 | authorizedFilter, err := prepared.CompileToSQL(ctx, regosql.ConvertConfig{ |
nothing calls this directly
no test coverage detected