Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunAddWizard ¶
func RunAddWizard(p prompter.Prompter, existing []*codegenpb.LockConnection, defaultFlag bool, presetName string) (name string, markDefault bool, err error)
RunAddWizard prompts for the connection name (unless presetName is non-empty) + resolves the default mark, validating against the existing connection set (no duplicate names; no conflicting default marks). `defaultFlag` carries the `--default` CLI flag — when true, the wizard skips the interactive default-mark prompt with that answer. Pulled out of Run so tests drive it without disk I/O or a console.
The console re-validates authoritatively on EditLock; the wizard's checks are just for a friendly local message + the interactive default prompt.
Types ¶
type AddCmd ¶
type AddCmd struct {
LockPath string `name:"lock" placeholder:"PATH" default:"w17/lock.yaml" help:"Path to the lock file."`
Console string `` /* 199-byte string literal not displayed */
Default bool `` /* 174-byte string literal not displayed */
Name string `` /* 148-byte string literal not displayed */
}
AddCmd implements `w17ctl connection add`. It registers a connection NAME in the lock's connections[] (re-signed by the console on save) and optionally marks it the project default. The wizard prompts for:
- Connection name — `<domain>-<role>` shape (validated non-empty + contains a dash; the role suffix conventionally names the dialect, e.g. app-postgres).
- (Conditional) — when adding the 2nd+ connection to a lock that has no `default: true` mark yet, asks whether to mark this one the default. `--default` skips the prompt with an explicit answer.
Dialect + version are deliberately NOT asked here: they belong to proto (`(w17.module).connection`), and codegen infers the dialect from the name suffix. The console authoritatively refuses a duplicate name or a conflicting default.
type Cmd ¶
type Cmd struct {
Add AddCmd `` /* 179-byte string literal not displayed */
SetDefault SetDefaultCmd `cmd:"set-default" help:"Mark a connection as the project's default. Existing default is unset in the same write."`
List ListCmd `cmd:"" help:"List the connections declared in the lock, with the default-connection marker."`
}
Cmd is the parent of `w17ctl connection <leaf>` commands: `add` (register a connection name + default mark), `set-default` (switch the lock's default-connection mark), `list` (read-only inventory).
NOTE: a connection's dialect + version are NOT managed here — they are declared in proto (`(w17.module).connection` in the domain's w17.proto), which is the code-aware source of truth. The lock only tracks the connection NAME (for migration-target pinning + default resolution) and which connection is the project default. Codegen derives the dialect from the `<domain>-<dialect>` name suffix (dialectFromConnectionName).
The console owns the lock. These commands treat `w17/lock.yaml` as opaque bytes — reads go through the console's DescribeLock RPC, mutations through EditLock (which re-maps + re-signs server-side). The client constructs no lockpb and signs nothing.
type ListCmd ¶
type ListCmd struct {
LockPath string `name:"lock" placeholder:"PATH" default:"w17/lock.yaml" help:"Path to the lock file."`
Console string `` /* 176-byte string literal not displayed */
}
ListCmd implements `w17ctl connection list`. One connection per line; the resolved default carries a `(default)` marker. The connection set + the resolved default come from the console's DescribeLock (the client doesn't parse the lock).
type SetDefaultCmd ¶
type SetDefaultCmd struct {
Name string `arg:"" name:"name" help:"Connection name to mark as the default."`
LockPath string `name:"lock" placeholder:"PATH" default:"w17/lock.yaml" help:"Path to the lock file."`
Console string `` /* 176-byte string literal not displayed */
}
SetDefaultCmd implements `w17ctl connection set-default <name>`. Ships a SetDefaultConnection intent to the console, which validates `<name>` exists, transfers the mark, re-signs + returns the bytes the client writes.
func (*SetDefaultCmd) Run ¶
func (c *SetDefaultCmd) Run() error