MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / loadAndCompile

Method loadAndCompile

internal/ext/wasm/wasm.go:53–73  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

51}
52
53func (r *Runner) loadAndCompile(ctx context.Context) (*runtimeAndCode, error) {
54 expected, err := r.getChecksum(ctx)
55 if err != nil {
56 return nil, err
57 }
58 cacheDir, err := cache.PluginsDir()
59 if err != nil {
60 return nil, err
61 }
62 value, err, _ := flight.Do(expected, func() (interface{}, error) {
63 return r.loadAndCompileWASM(ctx, cacheDir, expected)
64 })
65 if err != nil {
66 return nil, err
67 }
68 data, ok := value.(*runtimeAndCode)
69 if !ok {
70 return nil, fmt.Errorf("returned value was not a compiled module")
71 }
72 return data, nil
73}
74
75func (r *Runner) fetch(ctx context.Context, uri string) ([]byte, string, error) {
76 var body io.ReadCloser

Callers 1

InvokeMethod · 0.95

Calls 3

getChecksumMethod · 0.95
loadAndCompileWASMMethod · 0.95
PluginsDirFunction · 0.92

Tested by

no test coverage detected