templates

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 14 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.

Documentation

Overview

Package templates writes commented starter files for realms and databases into CONFIG_DIR (`backd template`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Path    string // relative to CONFIG_DIR, slash-separated
	Created bool   // false: it already existed and was left unchanged
}

File reports what happened to one file.

func CollectionPolicy added in v0.4.0

func CollectionPolicy(configDir, realm, database, collection string) ([]File, error)

CollectionPolicy creates <realm>/<database>/<collection>/collection.yaml, a commented example of the collection's rules, soft delete, and what an erase can do to it (everything is commented out: without a policy an erase leaves the collection alone). The collection must exist.

func Database

func Database(configDir, realm, database string, sample bool) ([]File, error)

Database creates <realm>/<database>/ under configDir; the realm must already exist. With sample, it adds the blog sample collection.

func EmailCapture added in v0.4.0

func EmailCapture(configDir, realm, database string) ([]File, error)

EmailCapture adds the development delivery function email-capture to <realm>/<database>/_functions, and the collection outbox it writes to. The database must exist.

func Function

func Function(configDir, realm, database, name string) ([]File, error)

Function creates the function <name> in <realm>/<database>/_functions, with the project's deno.json if it has none; the database must exist.

func Project

func Project(dir, realm string) ([]File, error)

Project creates a new, self-contained config repository at dir (which must not already exist): a realm with the sample database and collection, a sample function with tests, a compose stack on the released images (MongoDB, backd in dev mode, the executor, egress and MinIO) for local development, the check-only backd.yml workflow, an AGENTS.md for IDE assistants, and a README.

func Realm

func Realm(configDir, realm string, sample bool) ([]File, error)

Realm creates <realm>/realm.yaml, and the default email templates under <realm>/_realm/email/, under configDir. With sample, it also creates the database "main" with the blog sample collection.

Jump to

Keyboard shortcuts

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