Documentation
¶
Overview ¶
Package datapath is the file-like path people and agents type to name a place inside a database: `/lists/to-buy/items`. Odd segments are collections and even segments record ids. Ids are written and shown escaped the way record.EscapeID (dal-go/record) escapes them, so `a/b.txt` is `a%2Fb%2Etxt` everywhere: in input, output and the server's keys.
See spec/features/database-context-navigation (REQ:path-resolution) and decision 0008.
Index ¶
- func Printable(s string) string
- type Kind
- type Path
- func (p Path) Arg() string
- func (p Path) Child(segment string) Path
- func (p Path) Display() string
- func (p Path) Key() string
- func (p Path) Kind() Kind
- func (p Path) Name() string
- func (p Path) Parent() Path
- func (p Path) Segments() []string
- func (p Path) String() string
- func (p Path) URLKey() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path is an absolute location as unescaped segments; the zero value is "/".
func Resolve ¶
Resolve applies input to base: a leading `/` is absolute, anything else is relative; `.` stays, `..` goes up one segment and never above `/`, and empty segments are ignored. A `%` that does not start one of the six record.EscapeID sequences is invalid_argument.
func (Path) Arg ¶
Arg is Display as one shell argument, quoted when needed (POSIX quoting; PowerShell's on Windows), for commands people copy (paths.QuoteArg is the one quoting rule).
func (Path) Display ¶
Display is String made safe to print (see Printable); paths built from names the server returned may hold characters input never allows.
func (Path) Key ¶
Key is p as the server's key path: escaped segments without the leading slash ("lists/to-buy"); "" for the root.