projects
/
brevno-suite
/
hugo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2cb89a5
)
Adding ReaderTo and ToReader helper functions
author
spf13
<steve.francia@gmail.com>
Tue, 4 Nov 2014 05:26:56 +0000
(
00:26
-0500)
committer
spf13
<steve.francia@gmail.com>
Tue, 4 Nov 2014 05:26:56 +0000
(
00:26
-0500)
helpers/general.go
patch
|
blob
|
history
diff --git
a/helpers/general.go
b/helpers/general.go
index f68908d9a330dd8349d4bd976f606657c6f0d894..bfac5beae907534176c7738fa2050b005f35230d 100644
(file)
--- a/
helpers/general.go
+++ b/
helpers/general.go
@@
-64,6
+64,20
@@
func ReaderToBytes(lines io.Reader) []byte {
return b.Bytes()
}
+func ReaderToString(lines io.Reader) string {
+ b := new(bytes.Buffer)
+ b.ReadFrom(lines)
+ return b.String()
+}
+
+func StringToReader(in string) io.Reader {
+ return strings.NewReader(in)
+}
+
+func BytesToReader(in []byte) io.Reader {
+ return bytes.NewReader(in)
+}
+
// sliceToLower goes through the source slice and lowers all values.
func SliceToLower(s []string) []string {
if s == nil {