-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some types so they are available outside the package
- Loading branch information
Showing
2 changed files
with
40 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package benchmarks | ||
|
||
import ( | ||
"os" | ||
"sync" | ||
"time" | ||
) | ||
|
||
type ReportRecorder struct { | ||
mu sync.Mutex | ||
GitSHA string | ||
PostgresVersion string | ||
Timestamp int64 | ||
Reports []Report | ||
} | ||
|
||
func (r *ReportRecorder) AddReport(report Report) { | ||
r.mu.Lock() | ||
defer r.mu.Unlock() | ||
r.Reports = append(r.Reports, report) | ||
} | ||
|
||
func getPostgresVersion() string { | ||
return os.Getenv("POSTGRES_VERSION") | ||
} | ||
|
||
func newReportRecorder() *ReportRecorder { | ||
return &ReportRecorder{ | ||
GitSHA: os.Getenv("GITHUB_SHA"), | ||
PostgresVersion: getPostgresVersion(), | ||
Timestamp: time.Now().Unix(), | ||
Reports: []Report{}, | ||
} | ||
} | ||
|
||
type Report struct { | ||
Name string | ||
RowCount int | ||
RowsPerSecond float64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters