MCPcopy Create free account
hub / github.com/Permify/permify / NewDecoderFromURL

Function NewDecoderFromURL

pkg/development/file/decoder.go:20–35  ·  view source on GitHub ↗

NewDecoderFromURL - Creates new decoder

(url *url.URL)

Source from the content-addressed store, hash-verified

18
19// NewDecoderFromURL - Creates new decoder
20func NewDecoderFromURL(url *url.URL) (Decoder, error) {
21 switch url.Scheme {
22 case "file":
23 return NewFileDecoder(url.Path), nil
24 case "http", "https":
25 if url.Hostname() == "gist.github.com" {
26 url.Host = "gist.githubusercontent.com"
27 url.Path = path.Join(url.Path, "/raw")
28 }
29 return NewHTTPDecoder(url.String()), nil
30 case "":
31 return NewFileDecoder(url.Path), nil
32 default:
33 return nil, errors.New("unknown decoder type")
34 }
35}
36
37// FILE
38

Callers 3

coverageFunction · 0.92
runGenerateAstFunction · 0.92
validateFunction · 0.92

Calls 3

NewFileDecoderFunction · 0.85
NewHTTPDecoderFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected