Documentation
¶
Index ¶
- func CI(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Delete(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Describe(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Diff(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Docs(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Drop(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Insert(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func List(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Materialize(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Pull(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Rebase(getWd func() (string, error), ...) *cobra.Command
- func Resolve(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func ResolveDBPathArgs(dirPath string, homeDir func() (string, error), getWd func() (string, error)) (string, error)
- func Select(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func SelfUpdate(ver string, exitCode func(int)) *cobra.Command
- func Setup() *cobra.Command
- func Update(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Validate(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Version(ver, commit, date string) *cobra.Command
- type GitHubDBFactory
- type GitHubFileReaderFactory
- type TreeWriterFactory
- type ViewBuilderFactory
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 v0.65.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 Diff ¶ added in v0.65.0
func Diff( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), logf func(...any), exitCode func(int), ) *cobra.Command
Diff returns the diff command. exitCode is the process-exit seam (os.Exit in production, captured in tests): the command exits 1 when changes are found, 0 otherwise.
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( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), viewBuilder materializer.ViewBuilder, logf func(...any), isTerminal func() bool, runConflictsTUI func(context.Context, []string) error, ) *cobra.Command
Pull returns the pull command. It runs `git pull` with the chosen strategy, delegates conflict resolution to the shared working-tree engine, rebuilds materialized views, and prints a summary of the record changes the pull brought in.
func Resolve ¶
func Resolve( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), logf func(...any), isTerminal func() bool, runConflictsTUI func(ctx context.Context, files []string) error, ) *cobra.Command
Resolve returns the resolve command. It is the working-tree conflict engine: it auto-resolves merge conflicts in generated files (collection README.md) by regenerating them from source records and staging them, independent of which git operation produced the conflict. Source-data conflicts that need a human decision are handed to runConflictsTUI (interactive) on a terminal, or reported as text otherwise.
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 SelfUpdate ¶ added in v0.65.0
SelfUpdate returns the "self-update" command, which updates the installed ingitdb binary in place.
Package-managed installs (Homebrew cask, Snap) are never overwritten: the command prints the manager's exact upgrade command instead. Manual installs (release archive, go install) are updated in place by downloading the matching release asset, verifying its sha256 against the release's per-OS checksum file, and atomically replacing the executable. The --check flag reports availability without modifying anything; --yes (-y) skips the confirmation prompt; --version pins an exact release tag; --allow-downgrade permits a pinned target older than the running build.
ver is the running build's version (the value pinned by goreleaser ldflags, "dev" otherwise). exitCode is the process-exit seam (os.Exit in production, captured in tests): --check uses it to exit 10 when an update is available or the running version is undetermined.
Note: there is deliberately no "update" alias — `ingitdb update` is the SQL UPDATE verb 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.
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 v0.65.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.
Source Files
¶
- ci.go
- cobra_helpers.go
- conflict_resolver.go
- delete.go
- describe.go
- describe_format.go
- describe_output.go
- diff.go
- docs.go
- docs_update.go
- drop.go
- drop_remote.go
- drop_schema.go
- editor.go
- flags.go
- github_helpers.go
- insert.go
- insert_batch.go
- insert_context.go
- list.go
- materialize.go
- materialize_selection.go
- pull.go
- query_output.go
- rebase.go
- record_context.go
- record_merge_resolver.go
- record_projection.go
- recordset_read.go
- remote_helpers.go
- resolve.go
- seams.go
- select.go
- select_output.go
- select_where.go
- self_update.go
- setup.go
- update_new.go
- validate.go
- version.go
- view_builder_helper.go