templates

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 9 Imported by: 0

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 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 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, the Dockerfiles and compose stack (MongoDB, backd, the executor and egress) for local development, and the CI workflow from the docs' "Deploying config" guide — so "develop locally → CI → promote a tag" works from the first commit.

func Realm

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

Realm creates <realm>/realm.yaml 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