config

package
v0.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CfgFile = filepath.Join(CfgPath, "config.yaml")
View Source
var CfgPath = os.ExpandEnv("$HOME/.config/squix/")

Functions

func FromConnectionYaml

func FromConnectionYaml(yc *ConnectionYAML) db.DatabaseConnection

func GetNextQueryId

func GetNextQueryId(queries map[string]db.Query) int

Types

type Config

type Config struct {
	CurrentConnection  string                     `yaml:"current_connection"`
	Connections        map[string]*ConnectionYAML `yaml:"connections"`
	ColorScheme        string                     `yaml:"color_scheme"`
	CustomColorScheme  *styles.ColorScheme        `yaml:"custom_colors,omitempty"`
	History            History                    `yaml:"history"`
	DefaultRowLimit    int                        `yaml:"default_row_limit"`
	DefaultColumnWidth int                        `yaml:"default_column_width"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) Save

func (c *Config) Save() error

func (*Config) SaveQueryAndLast

func (c *Config) SaveQueryAndLast(connName string, query db.Query, saveAsLast bool) error

func (*Config) SaveQueryToConnection

func (c *Config) SaveQueryToConnection(connName string, query db.Query) (db.Query, error)

SaveQueryToConnection saves a query to a connection, generating an ID if needed If the query already exists (by name), it returns an error If query.Id == -1, a new ID will be generated

func (*Config) UpdateLastQuery

func (c *Config) UpdateLastQuery(connName string, query db.Query) error

type ConnectionYAML

type ConnectionYAML struct {
	Name       string              `yaml:"name"`
	DBType     string              `yaml:"db_type"`
	ConnString string              `yaml:"conn_string"`
	Schema     string              `yaml:"schema,omitempty"`
	Queries    map[string]db.Query `yaml:"queries"`
	LastQuery  db.Query            `yaml:"last_query"`
}

func ToConnectionYAML

func ToConnectionYAML(conn db.DatabaseConnection) *ConnectionYAML

type History

type History struct {
	Size int `yaml:"size"`
}

Jump to

Keyboard shortcuts

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