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

Method getChecksum

internal/ext/wasm/wasm.go:40–51  ·  view source on GitHub ↗

Verify the provided sha256 is valid.

(ctx context.Context)

Source from the content-addressed store, hash-verified

38
39// Verify the provided sha256 is valid.
40func (r *Runner) getChecksum(ctx context.Context) (string, error) {
41 if r.SHA256 != "" {
42 return r.SHA256, nil
43 }
44 // TODO: Add a log line here about something
45 _, sum, err := r.fetch(ctx, r.URL)
46 if err != nil {
47 return "", err
48 }
49 slog.Warn("fetching WASM binary to calculate sha256. Set this value in sqlc.yaml to prevent unneeded work", "sha256", sum)
50 return sum, nil
51}
52
53func (r *Runner) loadAndCompile(ctx context.Context) (*runtimeAndCode, error) {
54 expected, err := r.getChecksum(ctx)

Callers 1

loadAndCompileMethod · 0.95

Calls 1

fetchMethod · 0.95

Tested by

no test coverage detected