MCPcopy
hub / github.com/kashav/fsql / format

Method format

transform/format.go:51–67  ·  view source on GitHub ↗

format runs a format function based on the value of the provided attribute.

()

Source from the content-addressed store, hash-verified

49
50// format runs a format function based on the value of the provided attribute.
51func (p *FormatParams) format() (val interface{}, err error) {
52 switch p.Attribute {
53 case "name":
54 val = formatName(p.Args[0], p.Value.(string))
55 case "size":
56 val, err = p.formatSize()
57 case "time":
58 val, err = p.formatTime()
59 }
60 if err != nil {
61 return nil, err
62 }
63 if val == nil {
64 return nil, &ErrUnsupportedFormat{p.Args[0], p.Attribute}
65 }
66 return val, nil
67}
68
69// formatSize formats a size. Valid arguments include `KB`, `MB`, `GB` (case
70// insensitive).

Callers 1

FormatFunction · 0.45

Calls 3

formatSizeMethod · 0.95
formatTimeMethod · 0.95
formatNameFunction · 0.85

Tested by

no test coverage detected