initial commits

master
Charles Iliya Krempeaux 2022-12-14 09:49:55 -08:00
parent 13b1ad0e5d
commit 9f1650927e
1 changed files with 16 additions and 3 deletions

View File

@ -21,6 +21,7 @@ import (
// FileModTIme: time.Date(2022, 12, 12, 10, 30, 14, 2, time.UTC), // FileModTIme: time.Date(2022, 12, 12, 10, 30, 14, 2, time.UTC),
// } // }
type Content struct{ type Content struct{
value string
reader io.Reader reader io.Reader
size int64 size int64
closed bool closed bool
@ -41,11 +42,12 @@ var _ io.ReadCloser = &Content{}
// FileName: "message.md", // FileName: "message.md",
// FileModTIme: time.Now(), // FileModTIme: time.Now(),
// } // }
func CreateContent(s string) Content { func CreateContent(value string) Content {
var reader io.Reader = strings.NewReader(s) var reader io.Reader = strings.NewReader(value)
var size int64 = int64(len(s)) var size int64 = int64(len(value))
return Content{ return Content{
value:value,
reader:reader, reader:reader,
size:size, size:size,
} }
@ -155,3 +157,14 @@ func (receiver *Content) Size() int64 {
return receiver.size return receiver.size
} }
// String retusn the value of the string that strfs.Content is wrapping.
//
// String makes *strfs.Content fit the fmt.Stringer interface.
func (receiver *Content) String() string {
if nil == receiver {
return ""
}
return receiver.value
}