MCPcopy Index your code
hub / github.com/coder/coder / ListAuthorizedAIBridgeClients

Method ListAuthorizedAIBridgeClients

coderd/database/modelqueries.go:1054–1081  ·  view source on GitHub ↗
(ctx context.Context, arg ListAIBridgeClientsParams, prepared rbac.PreparedAuthorized)

Source from the content-addressed store, hash-verified

1052}
1053
1054func (q *sqlQuerier) ListAuthorizedAIBridgeClients(ctx context.Context, arg ListAIBridgeClientsParams, prepared rbac.PreparedAuthorized) ([]string, error) {
1055 authorizedFilter, err := prepared.CompileToSQL(ctx, regosql.ConvertConfig{
1056 VariableConverter: regosql.AIBridgeInterceptionConverter(),
1057 })
1058 if err != nil {
1059 return nil, xerrors.Errorf("compile authorized filter: %w", err)
1060 }
1061 filtered, err := insertAuthorizedFilter(listAIBridgeClients, fmt.Sprintf(" AND %s", authorizedFilter))
1062 if err != nil {
1063 return nil, xerrors.Errorf("insert authorized filter: %w", err)
1064 }
1065
1066 query := fmt.Sprintf("-- name: ListAIBridgeClients :many\n%s", filtered)
1067 rows, err := q.db.QueryContext(ctx, query, arg.Client, arg.Offset, arg.Limit)
1068 if err != nil {
1069 return nil, err
1070 }
1071 defer rows.Close()
1072 var items []string
1073 for rows.Next() {
1074 var client string
1075 if err := rows.Scan(&client); err != nil {
1076 return nil, err
1077 }
1078 items = append(items, client)
1079 }
1080 return items, nil
1081}
1082
1083func (q *sqlQuerier) ListAuthorizedAIBridgeSessions(ctx context.Context, arg ListAIBridgeSessionsParams, prepared rbac.PreparedAuthorized) ([]ListAIBridgeSessionsRow, error) {
1084 authorizedFilter, err := prepared.CompileToSQL(ctx, regosql.ConvertConfig{

Callers

nothing calls this directly

Calls 8

insertAuthorizedFilterFunction · 0.85
QueryContextMethod · 0.80
CompileToSQLMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.65
ErrorfMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected