mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 11:46:16 +00:00
eb9acb718e
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
32 lines
937 B
Go
32 lines
937 B
Go
package hyphae
|
|
|
|
import "sync"
|
|
|
|
// EmptyHypha is a hypha that does not exist and is not stored anywhere. You get one when querying for a hypha that was not created before.
|
|
type EmptyHypha struct {
|
|
sync.RWMutex
|
|
|
|
canonicalName string
|
|
}
|
|
|
|
func (e *EmptyHypha) CanonicalName() string {
|
|
return e.canonicalName
|
|
}
|
|
|
|
// ExtendEmptyToTextual returns a new textual hypha with the same name as the given empty hypha. The created hypha is not stored yet.
|
|
func ExtendEmptyToTextual(e *EmptyHypha, mycoFilePath string) *TextualHypha {
|
|
return &TextualHypha{
|
|
canonicalName: e.CanonicalName(),
|
|
mycoFilePath: mycoFilePath,
|
|
}
|
|
}
|
|
|
|
// ExtendEmptyToMedia returns a new media hypha with the same name as the given empty hypha. The created hypha is not stored yet.
|
|
func ExtendEmptyToMedia(e *EmptyHypha, mediaFilePath string) *MediaHypha {
|
|
return &MediaHypha{
|
|
canonicalName: e.CanonicalName(),
|
|
mycoFilePath: "",
|
|
mediaFilePath: mediaFilePath,
|
|
}
|
|
}
|