move file+gophermap --> filecontents.go to indicate parent interface

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
kim (grufwub) 2020-04-22 13:40:34 +01:00
parent 41ecadd6ee
commit 1fdacf9e19
2 changed files with 24 additions and 25 deletions

25
file.go
View File

@ -1,25 +0,0 @@
package main
/* RegularFileContents:
* Very simple implementation of FileContents that just
* buffered reads from the stored file path, stores the
* read bytes in a slice and returns when requested.
*/
type RegularFileContents struct {
path string
contents []byte
}
func (fc *RegularFileContents) Render() []byte {
return fc.contents
}
func (fc *RegularFileContents) Load() *GophorError {
var gophorErr *GophorError
fc.contents, gophorErr = bufferedRead(fc.path)
return gophorErr
}
func (fc *RegularFileContents) Clear() {
fc.contents = nil
}

View File

@ -6,6 +6,30 @@ import (
"strings"
)
/* RegularFileContents:
* Very simple implementation of FileContents that just
* buffered reads from the stored file path, stores the
* read bytes in a slice and returns when requested.
*/
type RegularFileContents struct {
path string
contents []byte
}
func (fc *RegularFileContents) Render() []byte {
return fc.contents
}
func (fc *RegularFileContents) Load() *GophorError {
var gophorErr *GophorError
fc.contents, gophorErr = bufferedRead(fc.path)
return gophorErr
}
func (fc *RegularFileContents) Clear() {
fc.contents = nil
}
/* GophermapContents:
* Implementation of FileContents that reads and
* parses a gophermap file into a slice of gophermap