This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
forked from ldsec/geco-i2b2-data-source
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added columns to all operations results
- Loading branch information
Showing
4 changed files
with
27 additions
and
2 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
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
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
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,20 @@ | ||
package datasource | ||
|
||
import ( | ||
"fmt" | ||
"math" | ||
) | ||
|
||
// generateColumnsLabels generates a list containing the string representations of the numbers from 0 to n-1, with the right number of leading 0s. | ||
// e.g., for n=16 -> ["00", "01, ..., "15"], for n=106 -> ["000", "001", ..., "115"] | ||
func generateColumnsLabels(n int) []string { | ||
|
||
labels := make([]string, n) | ||
figures := int(math.Ceil(math.Log10(float64(n)))) | ||
|
||
for i := 0; i < n; i++ { | ||
labels[i] = fmt.Sprintf(fmt.Sprintf("%%0%dd", figures), i) | ||
} | ||
|
||
return labels | ||
} |