-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d88565
commit c3f1d6b
Showing
10 changed files
with
204 additions
and
176 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
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 was deleted.
Oops, something went wrong.
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,30 @@ | ||
package client | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
// Records provides an export helper for a set of records. | ||
type Records []map[string]any | ||
|
||
// ToStrings converts the values in each map to strings. | ||
func (r Records) ToStrings() []map[string]string { | ||
if r == nil { | ||
return nil | ||
} | ||
|
||
records := make([]map[string]string, len(r)) | ||
for i, record := range r { | ||
records[i] = stringifyMap(record) | ||
} | ||
return records | ||
} | ||
|
||
// stringifyMap converts a Records instance into a map with the values converted to strings. | ||
func stringifyMap(r map[string]any) map[string]string { | ||
rec := make(map[string]string, len(r)) | ||
for k, v := range r { | ||
rec[k] = fmt.Sprintf("%v", v) | ||
} | ||
return rec | ||
} |
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
Oops, something went wrong.