1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-14 06:10:26 +00:00
mycorrhiza/hyphae/textual_hypha.go

35 lines
778 B
Go
Raw Normal View History

2022-02-19 08:26:38 +00:00
package hyphae
import (
"sync"
)
// TextualHypha is a hypha with text, and nothing else. An article, a note, a poem, whatnot.
2022-02-19 08:26:38 +00:00
type TextualHypha struct {
sync.RWMutex
canonicalName string
mycoFilePath string
}
func (t *TextualHypha) CanonicalName() string {
return t.canonicalName
}
func (t *TextualHypha) HasTextFile() bool {
return true
}
func (t *TextualHypha) TextFilePath() string {
return t.mycoFilePath
}
// ExtendTextualToMedia returns a new media hypha with the same name and text file as the given textual hypha. The new hypha is not stored yet.
2022-02-19 08:26:38 +00:00
func ExtendTextualToMedia(t *TextualHypha, mediaFilePath string) *MediaHypha {
return &MediaHypha{
canonicalName: t.CanonicalName(),
mycoFilePath: t.TextFilePath(),
mediaFilePath: mediaFilePath,
}
}