1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00
mycorrhiza/hyphae/textual_hypha.go
Timur Ismagilov eb9acb718e Break a lot of stuff
Starring:
* Broken error localization for now (got in the way)
* The title for error pages is the same for all errors (who cares anyway)
* New bugs
* The brand new /rename/ handler
2022-02-19 19:42:32 +03:00

35 lines
778 B
Go

package hyphae
import (
"sync"
)
// TextualHypha is a hypha with text, and nothing else. An article, a note, a poem, whatnot.
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.
func ExtendTextualToMedia(t *TextualHypha, mediaFilePath string) *MediaHypha {
return &MediaHypha{
canonicalName: t.CanonicalName(),
mycoFilePath: t.TextFilePath(),
mediaFilePath: mediaFilePath,
}
}