Documentation
¶
Overview ¶
Package uri implements the Synapse repo:// identifier grammar (SYN-11).
Index ¶
- Constants
- Variables
- func Assign(repo, filePath, nodeKind, name, legacyID string) (canonical string, ok bool, err error)
- func Build(repo, filePath, kindToken, symbol string) (string, error)
- func FromLegacy(repo, legacyID string) (canonical string, ok bool, err error)
- func KindToken(nodeKind string) (string, error)
- func NodeKind(kindToken string) (string, error)
- func Normalize(raw string) (string, error)
- func NormalizePath(p string) (string, error)
- func NormalizeRepo(repo string) (string, error)
- func RewriteRepo(raw, from, to string) (string, error)
- func Validate(raw string) error
- type LegacyParts
- type URI
Constants ¶
const ( Scheme = "repo" // PropKey is the node property holding the canonical repo:// URI. PropKey = "repo_uri" )
const ( KindFile = "file" KindPackage = "package" KindModule = "module" KindFunc = "func" KindMethod = "method" KindType = "type" KindImport = "import" KindSymbol = "symbol" KindOperation = "operation" KindSchema = "schema" KindField = "field" KindService = "service" KindDoc = "doc" KindHeading = "heading" )
Kind tokens as they appear in the URI fragment.
Variables ¶
var ( ErrInvalid = errors.New("uri: invalid repo:// URI") ErrConflict = errors.New("uri: conflict") )
Functions ¶
func Assign ¶
Assign builds a URI for a node from repo, path, and Node.Kind / name / props. Global unresolved symbols (kind symbol with empty path or id prefix symbol: without path) skip.
func FromLegacy ¶
FromLegacy builds a repo:// URI from a Phase-1 node id and repo name. Global symbol ids return ok=false without error (no URI assigned).
func NormalizePath ¶
NormalizePath makes a repo-relative slash path (no leading/trailing slash except empty).
func NormalizeRepo ¶
NormalizeRepo validates and lowercases? — keep case as given but trim. Repo names are case-sensitive as provided; only charset is restricted.
func RewriteRepo ¶
RewriteRepo remaps the repo segment of a repo:// URI from `from` to `to`. Non-repo:// strings are returned unchanged. A repo:// value that fails to parse is an error.
Types ¶
type LegacyParts ¶
type LegacyParts struct {
KindToken string
Path string
Symbol string
// GlobalSymbol is true for unresolved targets like "symbol:Name" with no path.
GlobalSymbol bool
}
LegacyParts holds components derived from a Phase-1 Node.ID.
func ParseLegacyID ¶
func ParseLegacyID(id string) (LegacyParts, error)
ParseLegacyID parses Phase-1 ids such as "func:path#Name" or "file:path".