fix: restore reviewable migration evidence
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
param([string]$RequestID)
|
||||
|
||||
if (-not $RequestID) { throw "RequestID is required" }
|
||||
|
||||
. .\tests\scripts\load-env.ps1 | Out-Null
|
||||
|
||||
$env:DUMP_RID = $RequestID
|
||||
@'
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ClickHouse/clickhouse-go/v2"
|
||||
|
||||
"git.misaka.ren/M1saka/token_thief/db"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
dsn := os.Getenv("CLICKHOUSE_URL")
|
||||
if dsn == "" {
|
||||
log.Fatal("CLICKHOUSE_URL not set")
|
||||
}
|
||||
rid := os.Getenv("DUMP_RID")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
opts, err := db.ClickHouseOptions(dsn)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
conn, err := clickhouse.Open(opts)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
var body string
|
||||
if err := conn.QueryRow(ctx,
|
||||
`SELECT response_body FROM proxy_logs WHERE request_id = ? ORDER BY started_at DESC LIMIT 1`,
|
||||
rid,
|
||||
).Scan(&body); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(body)
|
||||
}
|
||||
'@ | Set-Content -Path tmp_dump.go -Encoding UTF8 -NoNewline
|
||||
|
||||
go run tmp_dump.go
|
||||
Remove-Item tmp_dump.go -Force
|
||||
Remove-Item Env:DUMP_RID -ErrorAction SilentlyContinue
|
||||
Reference in New Issue
Block a user