ide

package
v1.33.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ide keeps a project's IDE-side pointers at lerd in sync. An IDE cannot discover a site's database on its own: the site's env file carries the container host and port, which are right inside the network and unusable from the machine, and no format is shared across IDEs for a project to declare one. JetBrains keeps its data sources in a plain XML file, so lerd maintains one entry there with host-facing coordinates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Owns

func Owns(name string) bool

Owns reports whether a data source name is one lerd maintains.

func Remove

func Remove(projectDir string) (bool, error)

Remove drops every entry lerd maintains and leaves everything else as it was.

Types

type DataSource

type DataSource struct {
	Key    string // stable within a project, e.g. the database name
	Name   string // shown in the IDE's database tool window
	Driver string // driver-ref, e.g. "postgresql"
	Class  string // JDBC driver class
	URL    string // full jdbc: URL
	User   string // the IDE authenticates with this, from its own sidecar
}

DataSource is one connection as the IDE stores it. Key identifies it inside a project, so an entry is updated in place across runs, and one whose database the project no longer uses can be told apart from one that is still wanted.

type Outcome

type Outcome int

Outcome says what a sync did, so a caller can tell a user why nothing was written rather than list the reasons it might have been.

const (
	// NotJetBrains means the project has no .idea directory.
	NotJetBrains Outcome = iota
	// AlreadyConfigured means a data source already points at the same database.
	AlreadyConfigured
	// Written means lerd's entry was added or brought up to date.
	Written
)

func Sync

func Sync(projectDir string, sources []DataSource) ([]Outcome, error)

Sync writes lerd's data source into the project's JetBrains configuration. A project with no .idea directory is not open in a JetBrains IDE, and lerd creating one would be litter, so it is left alone. Sync brings the project's JetBrains configuration in line with the given set of connections: lerd's own entries are replaced by exactly these, and every other data source in the files is left as it was. The outcome of each source is returned in the order it was given.

Jump to

Keyboard shortcuts

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