Documentation ¶
Index ¶
- Constants
- func GetConfigDir() (string, error)
- func GetConfigPath() (string, error)
- func ParseMongoDBURI(uri string) (host, port, db string, err error)
- type AutocompleteStyle
- type Config
- func (c *Config) AddConnection(mongoConfig *MongoConfig) error
- func (c *Config) AddConnectionFromUri(mongoConfig *MongoConfig) error
- func (c *Config) DeleteConnection(name string) error
- func (c *Config) GetCurrentConnection() *MongoConfig
- func (c *Config) GetEditorCmd() (string, error)
- func (c *Config) SetCurrentConnection(name string) error
- func (c *Config) UpdateConfig() error
- type ConnectorFormKeys
- type ConnectorKeys
- type ConnectorListKeys
- type ConnectorStyle
- type ContentKeys
- type ContentStyle
- type DatabasesKeys
- type DatabasesStyle
- type DocPeekerStyle
- type EditorConfig
- type GlobalKeys
- type HeaderStyle
- type HelpKeys
- type HelpStyle
- type HistoryStyle
- type InputBarStyle
- type Key
- type KeyBindings
- type LogConfig
- type MongoConfig
- type OrderedKeys
- type OthersStyle
- type QueryBar
- type RootKeys
- type RootStyle
- type Style
- type Styles
- type WelcomeStyle
Constants ¶
const (
ConfigDirName = "mongui"
)
Variables ¶
This section is empty.
Functions ¶
func GetConfigDir ¶
GetConfigDir returns the path to the config directory
func GetConfigPath ¶
GetConfigPath returns the path to the config file
func ParseMongoDBURI ¶
Types ¶
type AutocompleteStyle ¶
type AutocompleteStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TextColor Style `yaml:"textColor"` ActiveBackgroundColor Style `yaml:"activeBackgroundColor"` ActiveTextColor Style `yaml:"activeTextColor"` SecondaryTextColor Style `yaml:"secondaryTextColor"` }
Styles is a struct that contains all the styles for the application
type Config ¶
type Config struct { Log LogConfig `yaml:"log"` Debug bool `yaml:"debug"` Editor EditorConfig `yaml:"editor"` ShowConnectionPage bool `yaml:"showConnectionPage"` ShowWelcomePage bool `yaml:"showWelcomePage"` CurrentConnection string `yaml:"currentConnection"` Connections []MongoConfig `yaml:"connections"` }
func LoadConfig ¶
LoadConfig loads the config file If the file does not exist, it will be created with the default settings
func (*Config) AddConnection ¶
func (c *Config) AddConnection(mongoConfig *MongoConfig) error
AddConnection adds a MongoDB connection to the config file
func (*Config) AddConnectionFromUri ¶
func (c *Config) AddConnectionFromUri(mongoConfig *MongoConfig) error
AddConnectionFromUri adds a MongoDB connection to the config file using a URI
func (*Config) DeleteConnection ¶
DeleteConnection deletes a config from the config file by name
func (*Config) GetCurrentConnection ¶
func (c *Config) GetCurrentConnection() *MongoConfig
GetCurrentConnection gets the current connection from the config file
func (*Config) GetEditorCmd ¶
GetEditorCmd returns the editor command from the config file
func (*Config) SetCurrentConnection ¶
SetCurrentConnection sets the current connection in the config file
func (*Config) UpdateConfig ¶
UpdateConfig updates the config file with the new settings
type ConnectorFormKeys ¶
type ConnectorKeys ¶
type ConnectorKeys struct { ConnectorForm ConnectorFormKeys `json:"connectorForm"` ConnectorList ConnectorListKeys `json:"connectorList"` }
type ConnectorListKeys ¶
type ConnectorStyle ¶
type ConnectorStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` FormLabelColor Style `yaml:"formLabelColor"` FormInputBackgroundColor Style `yaml:"formInputBackgroundColor"` FormInputColor Style `yaml:"formInputColor"` FormButtonColor Style `yaml:"formButtonColor"` ListTextColor Style `yaml:"listTextColor"` ListSelectedTextColor Style `yaml:"listSelectedTextColor"` ListSelectedBackgroundColor Style `yaml:"listSelectedBackgroundColor"` ListSecondaryTextColor Style `yaml:"listSecondaryTextColor"` ListSecondaryBackgroundColor Style `yaml:"listSecondaryBackgroundColor"` }
ConnectorStyle is a struct that contains all the styles for the connector
type ContentKeys ¶
type ContentKeys struct { PeekDocument Key `json:"peekDocument"` ViewDocument Key `json:"viewDocument"` AddDocument Key `json:"addDocument"` EditDocument Key `json:"editDocument"` DuplicateDocument Key `json:"duplicateDocument"` DeleteDocument Key `json:"deleteDocument"` Refresh Key `json:"refresh"` ToggleQuery Key `json:"toggleQuery"` NextPage Key `json:"nextPage"` PreviousPage Key `json:"previousPage"` QueryBar QueryBar `json:"queryBar"` }
type ContentStyle ¶
type ContentStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` CellTextColor Style `yaml:"cellTextColor"` ActiveRowColor Style `yaml:"activeRowColor"` SelectedRowColor Style `yaml:"selectedRowColor"` }
ContentStyle is a struct that contains all the styles for the content
type DatabasesKeys ¶
type DatabasesStyle ¶
type DatabasesStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` NodeColor Style `yaml:"nodeColor"` NodeSymbol Style `yaml:"nodeSymbol"` LeafColor Style `yaml:"leafColor"` LeafSymbol Style `yaml:"leafSymbol"` BranchColor Style `yaml:"branchColor"` }
DatabasesStyle is a struct that contains all the styles for the databases
type DocPeekerStyle ¶
type DocPeekerStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` KeyColor Style `yaml:"keyColor"` ValueColor Style `yaml:"valueColor"` BracketColor Style `yaml:"bracketColor"` }
DocPeekerStyle is a struct that contains all the styles for the json peeker
type EditorConfig ¶
type GlobalKeys ¶
type GlobalKeys struct { ToggleFullScreenHelp Key `json:"toggleFullScreenHelp"` }
GlobalKeys is a struct that holds the global keybindings for the application, they can be triggered from any component as keys are passed from top to bottom
type HeaderStyle ¶
type HeaderStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` KeyColor Style `yaml:"keyColor"` ValueColor Style `yaml:"valueColor"` ActiveSymbol Style `yaml:"activeSymbol"` InactiveSymbol Style `yaml:"inactiveSymbol"` }
HeaderStyle is a struct that contains all the styles for the header
type HelpStyle ¶
type HelpStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` KeyColor Style `yaml:"keyColor"` DescriptionColor Style `yaml:"descriptionColor"` }
Styles is a struct that contains all the styles for the application
type HistoryStyle ¶
type HistoryStyle struct { BackgroundColor Style `yaml:"backgroundColor"` TextColor Style `yaml:"textColor"` SelectedTextColor Style `yaml:"selectedTextColor"` SelectedBackgroundColor Style `yaml:"selectedBackgroundColor"` }
Styles is a struct that contains all the styles for the application
type InputBarStyle ¶
type InputBarStyle struct { BackgroundColor Style `yaml:"backgroundColor"` BorderColor Style `yaml:"borderColor"` TitleColor Style `yaml:"titleColor"` LabelColor Style `yaml:"labelColor"` InputColor Style `yaml:"inputColor"` Autocomplete AutocompleteStyle `yaml:"autocomplete"` }
InputBarStyle is a struct that contains all the styles for the filter bar
type Key ¶
type Key struct { Keys []string `json:"keys,omitempty"` Runes []string `json:"runes,omitempty"` Description string `json:"description"` }
Key is a lowest level of keybindings It holds the keys and runes that are used to trigger the action and a description of the action that will be displayed in the help
type KeyBindings ¶
type KeyBindings struct { Global GlobalKeys `json:"global"` Root RootKeys `json:"root"` Connector ConnectorKeys `json:"connector"` Help HelpKeys `json:"help"` }
KeyBindings is a way to define keybindings for the application There are components that have only keybindings and some have nested keybindings of their children components
func LoadKeybindings ¶
func LoadKeybindings() (*KeyBindings, error)
LoadKeybindings loads keybindings from the config file if the file does not exist it creates a new one with default keybindings
func (*KeyBindings) Contains ¶
func (kb *KeyBindings) Contains(configKey Key, namedKey string) bool
Contains checks if the keybindings contains the key
func (*KeyBindings) ConvertStrKeyToTcellKey ¶
func (kb *KeyBindings) ConvertStrKeyToTcellKey(key string) (tcell.Key, bool)
ConvertStrKeyToTcellKey converts string key to tcell key
func (KeyBindings) GetKeysForComponent ¶
func (kb KeyBindings) GetKeysForComponent(component string) ([]OrderedKeys, error)
GetKeysForComponent returns keys for component
type MongoConfig ¶
type MongoConfig struct { Uri string `yaml:"url"` Host string `yaml:"host"` Port int `yaml:"port"` Database string `yaml:"database"` Username string `yaml:"username"` Password string `yaml:"password"` Name string `yaml:"name"` Timeout int `yaml:"timeout"` }
func (*MongoConfig) GetUri ¶
func (m *MongoConfig) GetUri() string
type OrderedKeys ¶
type OthersStyle ¶
type OthersStyle struct { ButtonsTextColor Style `yaml:"buttonsTextColor"` ButtonsBackgroundColor Style `yaml:"buttonsBackgroundColor"` }
Styles is a struct that contains all the styles for the application
type RootKeys ¶
type RootKeys struct { FocusNext Key `json:"focusNext"` HideDatabases Key `json:"hideDatabases"` OpenConnector Key `json:"openConnector"` Databases DatabasesKeys `json:"databases"` Content ContentKeys `json:"content"` }
type RootStyle ¶
type RootStyle struct { BackgroundColor Style `yaml:"backgroundColor"` TextColor Style `yaml:"textColor"` SecondaryTextColor Style `yaml:"secondaryTextColor"` BorderColor Style `yaml:"borderColor"` FocusColor Style `yaml:"focusColor"` TitleColor Style `yaml:"titleColor"` GraphicsColor Style `yaml:"graphicsColor"` }
RootStyle is a struct that contains all the root styles for the application
type Style ¶
type Style string
Styles is a struct that contains all the styles for the application
type Styles ¶
type Styles struct { Root RootStyle `yaml:"main"` Welcome WelcomeStyle `yaml:"welcome"` Connector ConnectorStyle `yaml:"connector"` Header HeaderStyle `yaml:"header"` Databases DatabasesStyle `yaml:"databases"` Content ContentStyle `yaml:"content"` DocPeeker DocPeekerStyle `yaml:"docPeeker"` InputBar InputBarStyle `yaml:"filterBar"` History HistoryStyle `yaml:"history"` Help HelpStyle `yaml:"help"` Others OthersStyle `yaml:"others"` }
Styles is a struct that contains all the styles for the application
func LoadStyles ¶
LoadStyles creates a new Styles struct with default values
type WelcomeStyle ¶
type WelcomeStyle struct { BackgroundColor Style `yaml:"backgroundColor"` TextColor Style `yaml:"textColor"` FormLabelColor Style `yaml:"formLabelColor"` FormInputColor Style `yaml:"formInputColor"` FormInputBackgroundColor Style `yaml:"formInputBackgroundColor"` }
WelcomeStyle is a struct that contains all the styles for the welcome screen