sdk

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sdk is how dokku-datastore is embedded. The dokku-datastore binary runs it with Run, and a dokku plugin serving every datastore under a single command, such as `dokku datastore:create postgres lollipop`, builds its commands, subcommands and triggers binaries around RunCommands, RunSubcommand and RunTrigger.

Index

Constants

View Source
const AppName = "dokku-datastore"

AppName is the name of the cli tool

View Source
const Namespace = "datastore"

Namespace is the dokku command every datastore is reached through by the plugin serving all of them

Variables

This section is empty.

Functions

func Commands

func Commands(ctx context.Context, meta command.Meta) map[string]cli.CommandFactory

Commands returns every command the binary implements, keyed by name

func Run

func Run(input RunInput) int

Run executes a command of the binary, as the dokku-datastore cli does, and returns its exit code

func RunCommands

func RunCommands(args []string) int

RunCommands answers whatever dokku hands the plugin's commands binary: the help it asks every plugin for, and any of the plugin's commands it found no subcommand for, which is what a datastore's own commands are.

func RunSubcommand

func RunSubcommand(name string, args []string) int

RunSubcommand runs one of a datastore's commands the way dokku's subcommands binary is asked for it: name is the command, from the binary's file name, and args are what dokku passed after the command itself, starting with the datastore type, as in `create postgres lollipop`.

func RunTrigger

func RunTrigger(name string, args []string) int

RunTrigger runs a dokku trigger for every datastore no per-datastore plugin serves, the way dokku runs a plugin's trigger binary: name is the trigger, from the binary's file name, and args are what dokku passed it. It stops at the first datastore that fails, as dokku stops at the first plugin that does.

func SubcommandNames

func SubcommandNames() []string

SubcommandNames are the commands every datastore may implement, which is what an embedding plugin links a subcommand for. A datastore's own commands are not among them: they are reached through RunCommands.

func TriggerNames

func TriggerNames() []string

TriggerNames are the dokku triggers an embedding plugin links a trigger for: the ones every datastore implements, install and update, and every one a datastore's definitions declare

func Types

func Types() []string

Types are the datastores the binary serves

func Version

func Version() string

Version is the version of dokku-datastore that is running: the one Run was handed, or else the one go recorded for this module when the binary embedding it was built, which is the version an embedding plugin requires

Types

type RunInput

type RunInput struct {
	// AppName is the name the cli reports itself as, AppName when empty
	AppName string

	// Args are the arguments, without the program name
	Args []string

	// Version is the version the cli reports, Version() when empty
	Version string
}

RunInput is the input for Run

Jump to

Keyboard shortcuts

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