commands

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CI added in v0.37.4

func CI(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	viewBuilder materializer.ViewBuilder,
	logf func(...any),
) *cobra.Command

CI returns the ci command. Currently it executes materialize; future versions may add CI-specific optimisations such as validating and materializing only the collections affected by a pull-request diff.

func Delete

func Delete(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	newDB func(string, *ingitdb.Definition) (dal.DB, error),
	logf func(...any),
) *cobra.Command

Delete returns the `ingitdb delete` command. Two modes inherited from sqlflags: single-record (--id) and set (--from + --where|--all). --min-affected guards set-mode invocations with all-or-nothing destructive atomicity: when the matched count is below the threshold, NO record is deleted.

This command replaces the legacy `delete record`, `delete records`, `delete collection`, and `delete view` subcommands. Per cli-sql-verbs Idea: when a new verb's name collides with an old top-level command, the legacy parent is removed in the same release.

func Describe added in v1.11.0

func Describe(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
) *cobra.Command

Describe returns the `ingitdb describe` command. Two kinds are supported: `describe collection <name>` (alias `table`) and `describe view <name>` (with `--in=<collection>` to disambiguate). `desc` is registered as a top-level alias for `describe`.

func Docs added in v0.26.0

func Docs(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	logf func(...any),
) *cobra.Command

Docs returns the docs command.

func Drop added in v0.64.0

func Drop(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	newDB func(string, *ingitdb.Definition) (dal.DB, error),
	logf func(...any),
) *cobra.Command

Drop returns the `ingitdb drop` command. Two kinds are supported: `drop collection <name>` and `drop view <name>`. The flags --if-exists (idempotent on missing target) and --cascade (no-op in the current data model; reserved for future cross-object dependency graphs) are inherited by both subcommands.

func Insert added in v0.61.0

func Insert(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	newDB func(string, *ingitdb.Definition) (dal.DB, error),
	logf func(...any),
	stdin io.Reader,
	isStdinTTY func() bool,
	openEditor func(string) error,
) *cobra.Command

Insert returns the `ingitdb insert` command.

Required: --into=<collection>. Exactly one data source: --data, stdin (when not a TTY), --edit (opens $EDITOR), or --empty (key-only record). Record key comes from --key or a top-level $id field in the data; supplying both with different values is rejected.

func List

func List(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
) *cobra.Command

List returns the list command.

func Materialize

func Materialize(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	viewBuilder materializer.ViewBuilder,
	logf func(...any),
) *cobra.Command

Materialize returns the materialize command.

func Pull

func Pull() *cobra.Command

Pull returns the pull command.

func Rebase added in v0.27.0

func Rebase(
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	logf func(...any),
) *cobra.Command

func Resolve

func Resolve() *cobra.Command

Resolve returns the resolve command.

func ResolveDBPathArgs added in v0.52.0

func ResolveDBPathArgs(
	dirPath string,
	homeDir func() (string, error),
	getWd func() (string, error),
) (string, error)

ResolveDBPathArgs resolves a database directory path from an explicit dirPath string (e.g. from a --path flag already read by the caller), falling back to getWd when dirPath is empty. Home-directory expansion ("~") is applied via homeDir.

func Select added in v0.60.0

func Select(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	newDB func(string, *ingitdb.Definition) (dal.DB, error),
	logf func(...any),
) *cobra.Command

Select returns the `ingitdb select` command. It queries records from a single collection in either single-record mode (--id) or set mode (--from with optional --where/--order-by/--fields/--limit/--min-affected). Output format defaults to yaml in single-record mode and csv in set mode.

func Serve

func Serve(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	newDB func(string, *ingitdb.Definition) (dal.DB, error),
	logf func(...any),
) *cobra.Command

Serve returns the serve command.

func Setup

func Setup() *cobra.Command

Setup returns the setup command.

func Update added in v0.9.0

func Update(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	newDB func(string, *ingitdb.Definition) (dal.DB, error),
	logf func(...any),
) *cobra.Command

Update returns the `ingitdb update` command. Two modes inherited from sqlflags: single-record (--id) and set (--from + --where|--all). Patch operations: --set (repeatable assignment) and --unset (comma-separated field list). Shallow patch at the top level. --min-affected guards set-mode invocations with all-or-nothing semantics.

func Validate

func Validate(
	homeDir func() (string, error),
	getWd func() (string, error),
	readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error),
	dataVal datavalidator.DataValidator,
	incVal datavalidator.IncrementalValidator,
	logf func(...any),
) *cobra.Command

Validate returns the validate command.

func Version

func Version(ver, commit, date string) *cobra.Command

Version returns the version command.

func Watch

func Watch() *cobra.Command

Watch returns the watch command.

Types

type GitHubDBFactory added in v0.14.0

type GitHubDBFactory interface {
	NewGitHubDBWithDef(cfg dalgo2ghingitdb.Config, def *ingitdb.Definition) (dal.DB, error)
}

GitHubDBFactory creates a GitHub-backed DAL database.

type GitHubFileReaderFactory added in v0.14.0

type GitHubFileReaderFactory interface {
	NewGitHubFileReader(cfg dalgo2ghingitdb.Config) (dalgo2ghingitdb.FileReader, error)
}

GitHubFileReaderFactory creates a GitHub file reader.

type TreeWriterFactory added in v1.1.0

type TreeWriterFactory interface {
	NewTreeWriter(cfg dalgo2ghingitdb.Config) (treeWriter, error)
}

TreeWriterFactory creates a treeWriter for atomic multi-file commits.

type ViewBuilderFactory added in v0.14.0

type ViewBuilderFactory interface {
	ViewBuilderForCollection(colDef *ingitdb.CollectionDef) (materializer.ViewBuilder, error)
}

ViewBuilderFactory creates a view builder for a collection.

Directories

Path Synopsis
Package sqlflags implements the shared CLI flag grammar for the SQL-verb commands (select, insert, update, delete, drop).
Package sqlflags implements the shared CLI flag grammar for the SQL-verb commands (select, insert, update, delete, drop).

Jump to

Keyboard shortcuts

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