Documentation ¶
Index ¶
- Constants
- func ExtractStyles() error
- func GetAllStyles() ([]string, error)
- func GetConfigPath() (string, error)
- func ParseMongoDBURI(uri string) (host, port, db string, err error)
- func SymbolWithColor(symbol Style, color Style) string
- type AIQuery
- type AIQueryStyle
- 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 ConnectionFormKeys
- type ConnectionKeys
- type ConnectionListKeys
- type ConnectionStyle
- type ContentKeys
- type ContentStyle
- type DatabaseKeys
- type DatabasesStyle
- type DocPeekerStyle
- type EditorConfig
- type GlobalKeys
- type GlobalStyles
- type HeaderStyle
- type HelpKeys
- type HelpStyle
- type HistoryKeys
- type HistoryStyle
- type IndexKeys
- type InputBarStyle
- type Key
- type KeyBindings
- type LogConfig
- type MainKeys
- type MongoConfig
- type MongoOptions
- type OrderedKeys
- type OthersStyle
- type PeekerKeys
- type QueryBar
- type SortBar
- type Style
- type StyleChangeStyle
- type Styles
- type StylesConfig
- type TabBarStyle
- type WelcomeKeys
- type WelcomeStyle
Constants ¶
const ( ConfigFile = "config.yaml" LogPath = "/tmp/vi-mongo.log" )
Variables ¶
This section is empty.
Functions ¶
func ExtractStyles ¶
func ExtractStyles() error
func GetAllStyles ¶
func GetConfigPath ¶
GetConfigPath returns the path to the config file
func ParseMongoDBURI ¶
func SymbolWithColor ¶ added in v0.1.4
Types ¶
type AIQueryStyle ¶ added in v0.1.12
type AIQueryStyle struct { FormLabelColor Style `yaml:"formLabelColor"` FormInputBackgroundColor Style `yaml:"formInputBackgroundColor"` FormInputColor Style `yaml:"formInputColor"` }
Styles is a struct that contains all the styles for the application
type AutocompleteStyle ¶
type AutocompleteStyle struct { BackgroundColor Style `yaml:"backgroundColor"` 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 { Version string `yaml:"version"` Log LogConfig `yaml:"log"` Editor EditorConfig `yaml:"editor"` ShowConnectionPage bool `yaml:"showConnectionPage"` ShowWelcomePage bool `yaml:"showWelcomePage"` CurrentConnection string `yaml:"currentConnection"` Connections []MongoConfig `yaml:"connections"` Styles StylesConfig `yaml:"styles"` }
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 ConnectionFormKeys ¶
type ConnectionKeys ¶
type ConnectionKeys struct { ToggleFocus Key `json:"toggleFocus"` ConnectionForm ConnectionFormKeys `json:"connectionForm"` ConnectionList ConnectionListKeys `json:"connectionList"` }
type ConnectionListKeys ¶
type ConnectionStyle ¶
type ConnectionStyle struct { FormLabelColor Style `yaml:"formLabelColor"` FormInputBackgroundColor Style `yaml:"formInputBackgroundColor"` FormInputColor Style `yaml:"formInputColor"` ListTextColor Style `yaml:"listTextColor"` ListSelectedTextColor Style `yaml:"listSelectedTextColor"` ListSelectedBackgroundColor Style `yaml:"listSelectedBackgroundColor"` ListSecondaryTextColor Style `yaml:"listSecondaryTextColor"` ListSecondaryBackgroundColor Style `yaml:"listSecondaryBackgroundColor"` }
ConnectionStyle is a struct that contains all the styles for the connection
type ContentKeys ¶
type ContentKeys struct { ChangeView Key `json:"switchView"` PeekDocument Key `json:"peekDocument"` FullPagePeek Key `json:"fullPagePeek"` AddDocument Key `json:"addDocument"` EditDocument Key `json:"editDocument"` DuplicateDocument Key `json:"duplicateDocument"` DeleteDocument Key `json:"deleteDocument"` CopyHighlight Key `json:"copyValue"` CopyDocument Key `json:"copyDocument"` Refresh Key `json:"refresh"` ToggleQueryBar Key `json:"toggleQueryBar"` NextDocument Key `json:"nextDocument"` PreviousDocument Key `json:"previousDocument"` NextPage Key `json:"nextPage"` PreviousPage Key `json:"previousPage"` ToggleSortBar Key `json:"toggleSortBar"` SortByColumn Key `json:"sortByColumn"` HideColumn Key `json:"hideColumn"` ResetHiddenColumns Key `json:"resetHiddenColumns"` }
type ContentStyle ¶
type ContentStyle struct { StatusTextColor Style `yaml:"statusTextColor"` HeaderRowBackgroundColor Style `yaml:"headerRowColor"` ColumnKeyColor Style `yaml:"columnKeyColor"` ColumnTypeColor Style `yaml:"columnTypeColor"` CellTextColor Style `yaml:"cellTextColor"` SelectedRowColor Style `yaml:"selectedRowColor"` }
ContentStyle is a struct that contains all the styles for the content
type DatabaseKeys ¶
type DatabasesStyle ¶
type DatabasesStyle struct { NodeTextColor Style `yaml:"nodeTextColor"` LeafTextColor Style `yaml:"leafTextColor"` NodeSymbolColor Style `yaml:"nodeSymbolColor"` LeafSymbolColor Style `yaml:"leafSymbolColor"` OpenNodeSymbol Style `yaml:"openNodeSymbol"` ClosedNodeSymbol Style `yaml:"closedNodeSymbol"` LeafSymbol Style `yaml:"leafSymbol"` }
DatabasesStyle is a struct that contains all the styles for the databases
type DocPeekerStyle ¶
type DocPeekerStyle struct { KeyColor Style `yaml:"keyColor"` ValueColor Style `yaml:"valueColor"` BracketColor Style `yaml:"bracketColor"` HighlightColor Style `yaml:"highlightColor"` }
DocPeekerStyle is a struct that contains all the styles for the json peeker
type EditorConfig ¶
type GlobalKeys ¶
type GlobalKeys struct { CloseApp Key `json:"closeApp"` ToggleFullScreenHelp Key `json:"toggleFullScreenHelp"` OpenConnection Key `json:"openConnection"` ShowStyleModal Key `json:"showStyleModal"` }
GlobalKeys is a struct that holds the global keybindings for the application, they can be triggered from any view as keys are passed from top to bottom
type GlobalStyles ¶
type GlobalStyles struct { // tview package styles BackgroundColor Style `yaml:"backgroundColor"` ContrastBackgroundColor Style `yaml:"contrastBackgroundColor"` MoreContrastBackgroundColor Style `yaml:"moreContrastBackgroundColor"` TextColor Style `yaml:"textColor"` SecondaryTextColor Style `yaml:"secondaryTextColor"` BorderColor Style `yaml:"borderColor"` FocusColor Style `yaml:"focusColor"` TitleColor Style `yaml:"titleColor"` GraphicsColor Style `yaml:"graphicsColor"` }
GlobalStyles is a struct that contains all the global styles for the application
type HeaderStyle ¶
type HeaderStyle struct { 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 { HeaderColor Style `yaml:"headerColor"` KeyColor Style `yaml:"keyColor"` DescriptionColor Style `yaml:"descriptionColor"` }
Styles is a struct that contains all the styles for the application
type HistoryKeys ¶
type HistoryStyle ¶
type HistoryStyle struct { 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 { 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"` Help HelpKeys `json:"help"` Welcome WelcomeKeys `json:"welcome"` Connection ConnectionKeys `json:"connection"` Main MainKeys `json:"main"` Database DatabaseKeys `json:"databases"` Content ContentKeys `json:"content"` Peeker PeekerKeys `json:"peeker"` QueryBar QueryBar `json:"queryBar"` SortBar SortBar `json:"sortBar"` Index IndexKeys `json:"index"` AIQuery AIQuery `json:"aiPrompt"` History HistoryKeys `json:"history"` }
KeyBindings is a way to define keybindings for the application There are views that have only keybindings and some have nested keybindings of their children views
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) GetAvaliableKeys ¶
func (kb KeyBindings) GetAvaliableKeys() []OrderedKeys
GetAvaliableKeys returns all keys
func (KeyBindings) GetKeysForElement ¶
func (kb KeyBindings) GetKeysForElement(elementId string) ([]OrderedKeys, error)
GetKeysForElement returns keys for element
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"` Options MongoOptions `yaml:"options"` }
func (*MongoConfig) GetOptions ¶ added in v0.1.18
func (c *MongoConfig) GetOptions() MongoOptions
GetOptions returns the options from the config file if they are not set, it returns the default values
func (*MongoConfig) GetSafeUri ¶
func (m *MongoConfig) GetSafeUri() string
GetSafeUri returns the URI with the password replaced by asterisks
func (*MongoConfig) GetUri ¶
func (m *MongoConfig) GetUri() string
GetUri returns the URI or builds it from the config
type MongoOptions ¶ added in v0.1.18
type OrderedKeys ¶
type OthersStyle ¶
type OthersStyle struct { // buttons ButtonsTextColor Style `yaml:"buttonsTextColor"` ButtonsBackgroundColor Style `yaml:"buttonsBackgroundColor"` DeleteButtonSelectedBackgroundColor Style `yaml:"deleteButtonSelectedBackgroundColor"` // modals specials ModalTextColor Style `yaml:"modalTextColor"` ModalSecondaryTextColor Style `yaml:"modalSecondaryTextColor"` // table separators SeparatorSymbol Style `yaml:"separatorSymbol"` SeparatorColor Style `yaml:"separatorColor"` }
OthersStyle is a struct that contains all the styles shared across components
type PeekerKeys ¶
type Style ¶
type Style string
Styles is a struct that contains all the styles for the application
func (*Style) Color ¶
func (s *Style) Color() tcell.Color
Color returns the tcell.Color of the style
func (*Style) GetWithColor ¶
SetColor sets the color of the style
type StyleChangeStyle ¶
type StyleChangeStyle struct { 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 Styles ¶
type Styles struct { Global GlobalStyles `yaml:"global"` Welcome WelcomeStyle `yaml:"welcome"` Connection ConnectionStyle `yaml:"connection"` Header HeaderStyle `yaml:"header"` TabBar TabBarStyle `yaml:"tabBar"` Databases DatabasesStyle `yaml:"databases"` Content ContentStyle `yaml:"content"` AIPrompt AIQueryStyle `yaml:"aiQuery"` DocPeeker DocPeekerStyle `yaml:"docPeeker"` InputBar InputBarStyle `yaml:"inputBar"` History HistoryStyle `yaml:"history"` Help HelpStyle `yaml:"help"` Others OthersStyle `yaml:"others"` StyleChange StyleChangeStyle `yaml:"styleChange"` }
Styles is a struct that contains all the styles for the application
func LoadStyles ¶
LoadStyles creates a new Styles struct with default values
func (*Styles) LoadMainStyles ¶
func (s *Styles) LoadMainStyles()
type StylesConfig ¶ added in v0.1.4
type TabBarStyle ¶ added in v0.1.5
type TabBarStyle struct { ActiveTextColor Style `yaml:"activeTextColor"` ActiveBackgroundColor Style `yaml:"activeBackgroundColor"` }
TabBarStyle is a struct that contains all the styles for the tab bar
type WelcomeKeys ¶
type WelcomeStyle ¶
type WelcomeStyle struct { 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