MCPcopy Create free account
hub / github.com/google/go-cloud / FromString

Method FromString

internal/openurl/openurl.go:58–68  ·  view source on GitHub ↗

FromString parses urlstr as an URL and looks up the value for the URL's scheme.

(typ, urlstr string)

Source from the content-addressed store, hash-verified

56
57// FromString parses urlstr as an URL and looks up the value for the URL's scheme.
58func (m *SchemeMap) FromString(typ, urlstr string) (any, *url.URL, error) {
59 u, err := url.Parse(urlstr)
60 if err != nil {
61 return nil, nil, fmt.Errorf("open %s.%s: %v", m.api, typ, err)
62 }
63 val, err := m.FromURL(typ, u)
64 if err != nil {
65 return nil, nil, err
66 }
67 return val, u, nil
68}
69
70// FromURL looks up the value for u's scheme.
71func (m *SchemeMap) FromURL(typ string, u *url.URL) (any, error) {

Callers 9

TestSchemeMapFunction · 0.95
OpenBucketMethod · 0.80
OpenKeeperMethod · 0.80
OpenPostgresMethod · 0.80
OpenCollectionMethod · 0.80
OpenMySQLMethod · 0.80
OpenTopicMethod · 0.80
OpenSubscriptionMethod · 0.80
OpenVariableMethod · 0.80

Calls 1

FromURLMethod · 0.95

Tested by 1

TestSchemeMapFunction · 0.76