config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TemplateDir stores the name of the directory that contains templates
	TemplateDir = "templates"
	// TemplateExt stores the extension used for the template files
	TemplateExt = ".html"
	// StaticPrefix stores the URL prefix used when serving static files
	StaticPrefix = "files"
	// Timeout stores default http server timeout
	HttpTimeout = time.Second * 180
	// CacheControl stores default cache time for StaticDir
	CacheControl = time.Hour * 24
)

Variables

View Source
var AppEnvironment = EnvDev
View Source
var DbDsn = ""

DbDsn forces db to connect from env var DB_DSN. Will not be able to connect to other databases

Functions

This section is empty.

Types

type Config

type Config struct {
	PagerSize        int         `comment:"Number of rows in each page when browsing tables"`
	HistEntries      []HistEntry `comment:"History of queries run"`
	HistEntryMax     int         `comment:"Maximum number of HistEntries to keep"`
	ConnectDSN       []string    `comment:"History of connected database server dsn"`
	ConnectDSNMax    int         `comment:"Maximum number of DSN entries to keep"`
	OpenInWebBrowser bool        `comment:"Open server url in web browser on startup"`
	// contains filtered or unexported fields
}

Config stores complete configuration

func GetConfig

func GetConfig() (Config, error)

GetConfig loads and returns configuration

func (*Config) AddDSN

func (c *Config) AddDSN(dsn string)

func (*Config) AddHistEntry

func (c *Config) AddHistEntry(query string)

func (*Config) DSNRecent

func (c *Config) DSNRecent() string

func (*Config) DSNsRecent

func (c *Config) DSNsRecent() []string

func (*Config) GetHistEntries

func (c *Config) GetHistEntries() []HistEntry

func (*Config) GetHistEntryRecent

func (c *Config) GetHistEntryRecent() string

func (*Config) SaveConf

func (c *Config) SaveConf() error

type Environment

type Environment string
var (
	EnvTest Environment = "test"
	EnvDev  Environment = "dev"
)

type HistEntry

type HistEntry struct {
	Query    string
	LastRun  time.Time
	RunCount int
}

func (HistEntry) String

func (h HistEntry) String() string

Jump to

Keyboard shortcuts

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