Files
gof3/tree/f3/topic.go
Earl Warren fb2e7aad84 tree/f3: define f3.Path with additional accessors
So they can be used like so to go from the root down:

p.Root().Forge().Users()
2024-03-08 18:37:26 +07:00

24 lines
500 B
Go

// Copyright Earl Warren <contact@earl-warren.org>
// Copyright Loïc Dachary <loic@dachary.org>
// SPDX-License-Identifier: MIT
package f3
import (
"fmt"
"lab.forgefriends.org/friendlyforgeformat/gof3/f3"
)
func NewTopicPath[T any](id T) Path {
return NewPathFromString(NewTopicPathString(id))
}
func NewTopicPathString[T any](id T) string {
return fmt.Sprintf("/forge/topics/%v", id)
}
func NewTopicReference[T any](id T) *f3.Reference {
return f3.NewReference(NewTopicPathString(id))
}