config

package
v0.0.0-...-9588241 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Dev = "dev"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	GetSiteName() string
	GetDescription() string
	GetTitle() string
	SetTitle(string)
	GetEnvironment() string
	GetTemplatePath() string
	GetTemplateExtension() string
	IsDev() bool
	GetHttpConfig() Http
	GetDatabaseConfig() Database
}

func NewConfig

func NewConfig(path string) (Config, error)

type Database

type Database interface {
	GetDSN() string
	GetDialect() string
	GetUser() string
	GetPassword() string
	GetAddress() string
	GetPort() uint16
	GetDBName() string
	GetParams() []string
	AddParams(...string)
}

type DatabaseImpl

type DatabaseImpl struct {
	Dialect  string   `yaml:"dialect"`
	User     string   `yaml:"user"`
	Password string   `yaml:"password"`
	Address  string   `yaml:"address"`
	Port     uint16   `yaml:"port"`
	DBName   string   `yaml:"db_name"`
	Params   []string `yaml:"params"`
}

func (*DatabaseImpl) AddParams

func (c *DatabaseImpl) AddParams(params ...string)

func (*DatabaseImpl) GetAddress

func (c *DatabaseImpl) GetAddress() string

func (*DatabaseImpl) GetDBName

func (c *DatabaseImpl) GetDBName() string

func (*DatabaseImpl) GetDSN

func (c *DatabaseImpl) GetDSN() string

func (*DatabaseImpl) GetDialect

func (c *DatabaseImpl) GetDialect() string

func (*DatabaseImpl) GetParams

func (c *DatabaseImpl) GetParams() []string

func (*DatabaseImpl) GetPassword

func (c *DatabaseImpl) GetPassword() string

func (*DatabaseImpl) GetPort

func (c *DatabaseImpl) GetPort() uint16

func (*DatabaseImpl) GetUser

func (c *DatabaseImpl) GetUser() string

type Http

type Http interface {
	GetAddr() string
	GetReadTimeout() time.Duration
	GetWriteTimeout() time.Duration
	GetStaticPath() string
}

type HttpImpl

type HttpImpl struct {
	Addr         string        `yaml:"addr"`
	ReadTimeout  time.Duration `yaml:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout"`
	StaticPath   string        `yaml:"static_path"`
}

func (*HttpImpl) GetAddr

func (hc *HttpImpl) GetAddr() string

func (*HttpImpl) GetReadTimeout

func (hc *HttpImpl) GetReadTimeout() time.Duration

func (*HttpImpl) GetStaticPath

func (hc *HttpImpl) GetStaticPath() string

func (*HttpImpl) GetWriteTimeout

func (hc *HttpImpl) GetWriteTimeout() time.Duration

type Impl

type Impl struct {
	SiteName          string        `yaml:"site_name"`
	Description       string        `yaml:"description"`
	Title             string        `yaml:"title"`
	Environment       string        `yaml:"environment"`
	TemplatePath      string        `yaml:"template_path"`
	TemplateExtension string        `yaml:"template_extension"`
	Http              *HttpImpl     `yaml:"http_config"`
	Database          *DatabaseImpl `yaml:"database_config"`
}

func (*Impl) GetDatabaseConfig

func (c *Impl) GetDatabaseConfig() Database

func (*Impl) GetDescription

func (c *Impl) GetDescription() string

func (*Impl) GetEnvironment

func (c *Impl) GetEnvironment() string

func (*Impl) GetHttpConfig

func (c *Impl) GetHttpConfig() Http

func (*Impl) GetSiteName

func (c *Impl) GetSiteName() string

func (*Impl) GetTemplateExtension

func (c *Impl) GetTemplateExtension() string

func (*Impl) GetTemplatePath

func (c *Impl) GetTemplatePath() string

func (*Impl) GetTitle

func (c *Impl) GetTitle() string

func (*Impl) IsDev

func (c *Impl) IsDev() bool

func (*Impl) SetTitle

func (c *Impl) SetTitle(title string)

Jump to

Keyboard shortcuts

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