Documentation
¶
Overview ¶
Package functions builds server-side functions: `backd functions build` bundles each function of a database's Deno project into one file with `deno bundle`, and records the bundles in a manifest that startup checks.
Index ¶
- Constants
- func Build(ctx context.Context, reg *registry.Registry, opts Options) error
- func DenoVersion(ctx context.Context, deno string) (string, error)
- func JSDocTypes(reg *registry.Registry) string
- func WriteTypes(reg *registry.Registry, realm, config string, dryRun bool) (changed, warnings []string, err error)
- type Options
Constants ¶
const ModuleName = "@backd/functions"
ModuleName is what functions import defineFunction from.
Variables ¶
This section is empty.
Functions ¶
func DenoVersion ¶
DenoVersion returns the version of the deno binary.
func JSDocTypes ¶
JSDocTypes generates JSDoc typedefs from every function's input and output JSON Schemas (`backd functions types`), for editor autocomplete on ctx.input and the return value. A function without a schema, or whose schema can't be read or parsed, is skipped (with a comment explaining why for the latter): this never fails outright, so the command always produces something to paste into an editor.
func WriteTypes ¶ added in v0.8.2
func WriteTypes(reg *registry.Registry, realm, config string, dryRun bool) (changed, warnings []string, err error)
WriteTypes writes backd.d.ts (and the runtime module it goes with) into the functions project of every database of the realm that has functions; realm "" means every realm. It returns the files it changed, and what the generator couldn't express. With dryRun it writes nothing and returns the files that would change.