MCPcopy Index your code
hub / github.com/rilldata/rill / APIForName

Method APIForName

runtime/api.go:62–78  ·  view source on GitHub ↗

APIForName returns the API with the given name for the given instance. It gives precedence to built-in APIs over project-specific dynamically created APIs.

(ctx context.Context, instanceID, name string)

Source from the content-addressed store, hash-verified

60// APIForName returns the API with the given name for the given instance.
61// It gives precedence to built-in APIs over project-specific dynamically created APIs.
62func (r *Runtime) APIForName(ctx context.Context, instanceID, name string) (*runtimev1.API, error) {
63 if api, ok := BuiltinAPIs[name]; ok {
64 return api, nil
65 }
66
67 ctrl, err := r.Controller(ctx, instanceID)
68 if err != nil {
69 return nil, err
70 }
71
72 resource, err := ctrl.Get(ctx, &runtimev1.ResourceName{Kind: ResourceKindAPI, Name: name}, false)
73 if err != nil {
74 return nil, err
75 }
76
77 return resource.GetApi(), nil
78}

Callers 11

TestBuiltinSQLFunction · 0.80
newAPIFunction · 0.80
TestBuiltinMetricsSQLFunction · 0.80
TestSimpleSQLApiFunction · 0.80
TestTemplateSQLApiFunction · 0.80
TestTemplateSQLApi2Function · 0.80
TestSimpleMetricsSQLApiFunction · 0.80
TestPolicyMetricsSQLAPIFunction · 0.80
apiHandlerMethod · 0.80

Calls 3

ControllerMethod · 0.95
GetApiMethod · 0.80
GetMethod · 0.65

Tested by 9

TestBuiltinSQLFunction · 0.64
TestBuiltinMetricsSQLFunction · 0.64
TestSimpleSQLApiFunction · 0.64
TestTemplateSQLApiFunction · 0.64
TestTemplateSQLApi2Function · 0.64
TestSimpleMetricsSQLApiFunction · 0.64
TestPolicyMetricsSQLAPIFunction · 0.64