initial commits
parent
13b1ad0e5d
commit
9f1650927e
19
content.go
19
content.go
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue