sources

command
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

WASM Source Module

This directory contains example source code for a WASM data source module.

Building

Requires TinyGo:

tinygo build -o quotes.wasm -target wasi quotes.go

Interface

WASM modules must export these functions to work with tinkerdown:

Required
Export Signature Description
fetch () -> i32 Fetch data, return pointer to JSON array
get_result_len () -> i32 Return length of last fetch result
Optional
Export Signature Description
free_result () -> void Free memory from last result
write (action_ptr, action_len, data_ptr, data_len) -> i32 Handle write ops, return 0=success
get_error () -> i32 Pointer to error string
get_error_len () -> i32 Length of error string

Configuration

Options passed to the source in tinkerdown.yaml are available as environment variables:

sources:
  quotes:
    type: wasm
    path: "./sources/quotes.wasm"
    options:
      category: "inspiration"  # Available as os.Getenv("category")
      api_key: "${API_KEY}"    # Env var substitution works

Data Format

The fetch function must return a pointer to a JSON array of objects:

[
  {"id": 1, "text": "Quote text", "author": "Author Name"},
  {"id": 2, "text": "Another quote", "author": "Another Author"}
]

Each object becomes a row in the template's .Data array.

Documentation

Overview

Example WASM source module for tinkerdown. Build with: tinygo build -o quotes.wasm -target=wasi quotes.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL