(id: string, projectId: string)
| 110 | } |
| 111 | |
| 112 | export async function getProfileById(id: string, projectId: string) { |
| 113 | if (id === '' || projectId === '') { |
| 114 | return null; |
| 115 | } |
| 116 | |
| 117 | const cachedProfile = await profileBuffer.fetchFromCache(id, projectId); |
| 118 | if (cachedProfile) { |
| 119 | return transformProfile(cachedProfile); |
| 120 | } |
| 121 | |
| 122 | const [profile] = await chQuery<IClickhouseProfile>( |
| 123 | `SELECT ${PROFILE_COLUMNS} |
| 124 | FROM ${TABLE_NAMES.profiles} FINAL |
| 125 | WHERE id = ${sqlstring.escape(String(id))} AND project_id = ${sqlstring.escape(projectId)} |
| 126 | LIMIT 1` |
| 127 | ); |
| 128 | |
| 129 | if (!profile) { |
| 130 | return null; |
| 131 | } |
| 132 | |
| 133 | return transformProfile(profile); |
| 134 | } |
| 135 | |
| 136 | interface GetProfileListOptions { |
| 137 | projectId: string; |
no test coverage detected