configs

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package configs contains the configuration for the application

Index

Constants

View Source
const (
	DriverPostgres  Driver = "pgx"
	DriverMySQL     Driver = "mysql"
	DriverSQLite    Driver = "sqlite"
	EnvDevelopment  string = "development"
	EnvProduction   string = "production"
	MinItemsPerPage int    = 5
	MaxItemsPerPage int    = 10
)
View Source
const (
	AnsiBackCursorToLineStart = "\x1b[1G"
	AnsiClearScreen           = "\033[2J\033[H"
	AnsiHideCursor            = "\x1b[?25l"
	AnsiShowCursor            = "\x1b[?25h"
	AnsiAlternateScreen       = "\x1b[?1049h"
	AnsiExitAlternateScreen   = "\x1b[?1049l"
)

Variables

View Source
var Drivers = map[Driver]Driver{
	"pgx":    DriverPostgres,
	"mysql":  DriverMySQL,
	"sqlite": DriverSQLite,
}

Functions

This section is empty.

Types

type AppConfig added in v0.1.8

type AppConfig struct {
	DisableAutoUpdate bool   `json:"disable_auto_update,omitempty"`
	Driver            Driver `json:"driver,omitempty"`
	MaxItemsPerPage   int    `json:"max_items_per_page,omitempty"`
	MinItemsPerPage   int    `json:"min_items_per_page,omitempty"`
	LogFilePath       string `json:"log_file_path,omitempty"`
}

type Config

type Config struct {
	ConnectionConfig
	AppConfig
}

func DefaultConfig added in v0.1.8

func DefaultConfig() Config

type ConfigFileFields added in v0.1.8

type ConfigFileFields struct {
	Connections []ConnectionConfig `json:"connections"`
	AppConfig
}

type ConfigService added in v0.1.8

type ConfigService interface {
	LoadConfig(path ...string) (Config, error)
	GetConfigPath() (string, error)
}

func NewConfigService added in v0.1.8

func NewConfigService(prompter Prompter) ConfigService

type ConfigServiceImpl added in v0.1.8

type ConfigServiceImpl struct {
	// contains filtered or unexported fields
}

func (*ConfigServiceImpl) GetConfigPath added in v0.1.8

func (c *ConfigServiceImpl) GetConfigPath() (string, error)

func (*ConfigServiceImpl) LoadConfig added in v0.1.8

func (c *ConfigServiceImpl) LoadConfig(configPath ...string) (Config, error)

type ConnectionConfig added in v0.1.8

type ConnectionConfig struct {
	Port     int    `json:"port"`
	DBString string `json:"db_string"`
	Env      string `json:"env,omitempty"`
}

type Driver added in v0.1.3

type Driver string

type Prompter added in v0.1.8

type Prompter interface {
	AskConnection(connections []ConnectionConfig) (*ConnectionConfig, error)
}

type PrompterImpl added in v0.1.8

type PrompterImpl struct{}

func (*PrompterImpl) AskConnection added in v0.1.8

func (p *PrompterImpl) AskConnection(configs []ConnectionConfig) (*ConnectionConfig, error)

Jump to

Keyboard shortcuts

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