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 ¶
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.
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.