Documentation
¶
Overview ¶
Package godolt wraps Dolt's operational surface for Go programs, following the gogit precedent (a standalone service-integration module).
Design: SQL-first. The primary workload is many concurrent sessions against `dolt sql-server` (the embedded driver sustains only one stable connection and is not a target), so version-control verbs run as Dolt stored procedures over the same MySQL wire as queries — the caller supplies the *sql.DB and godolt adds zero driver dependencies. The few operations that cannot run over the wire (clone/init bootstrap, server lifecycle) shell out to the dolt CLI (exec.go).
Index ¶
- func Available() bool
- func BackupAdd(ctx context.Context, dir, name, url string) error
- func BackupRestore(ctx context.Context, workDir, url, dbName string, force bool) error
- func BackupSync(ctx context.Context, dir, name string) error
- func Clone(ctx context.Context, remoteURL, dir string) error
- func InitDir(ctx context.Context, dir, name, email string) error
- type Client
- func (c *Client) ActiveBranch(ctx context.Context) (string, error)
- func (c *Client) Fetch(ctx context.Context, remote string) error
- func (c *Client) Pull(ctx context.Context, remote, branch string) (*PullResult, error)
- func (c *Client) Push(ctx context.Context, remote, branch string) (string, error)
- func (c *Client) RemoteAdd(ctx context.Context, name, url string) error
- func (c *Client) RemoteRemove(ctx context.Context, name string) error
- func (c *Client) Remotes(ctx context.Context) ([]Remote, error)
- type PullResult
- type Remote
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Available ¶
func Available() bool
Available reports whether the dolt CLI is on PATH (the cold path's prerequisite; the SQL path needs only a *sql.DB).
func BackupRestore ¶
BackupRestore restores a database from a backup URL into a new subdirectory named dbName under workDir (workDir must not already contain a directory of that name unless force is set).
func BackupSync ¶
BackupSync snapshots the Dolt database in dir (branches, tags, working sets) and uploads it to the named backup target.
Types ¶
type Client ¶
Client executes Dolt operations over an existing SQL connection to a dolt sql-server. The caller owns the *sql.DB (driver, pooling, DSN).
func (*Client) ActiveBranch ¶
ActiveBranch returns the connection's active branch.
func (*Client) Pull ¶
Pull pulls branch from remote (CALL DOLT_PULL) and merges into the active branch. DOLT_PULL returns three columns (fast_forward, conflicts, message) — a different shape from every other stored procedure call() handles, so Pull scans it directly rather than going through call(). A non-zero Conflicts count means DOLT_PULL completed the merge but left conflict rows in dolt_conflicts_<table> for the caller to resolve; it is not returned as an error, since that is expected, resolvable local state, not a failure of the pull itself.
func (*Client) Push ¶
Push pushes branch to remote (CALL DOLT_PUSH). Returns the server message (e.g. "Everything up-to-date").
func (*Client) RemoteRemove ¶
RemoteRemove removes a remote.
type PullResult ¶ added in v0.2.0
PullResult reports the outcome of a CALL DOLT_PULL.