Documentation
¶
Index ¶
- Variables
- type DevelopmentConfig
- type ErrInitializingEnvIsSet
- type RegisteredEnvs
- type TimeConfig
- func (c *TimeConfig) Date(t time.Time) string
- func (c *TimeConfig) DateUnix(ts int64) string
- func (c *TimeConfig) Datetime(t time.Time) string
- func (c *TimeConfig) DatetimeUnix(ts int64) string
- func (c *TimeConfig) Parse(s string) (time.Time, error)
- func (c *TimeConfig) Time(t time.Time) string
- func (c *TimeConfig) TimeInLocation(t time.Time) time.Time
- func (c *TimeConfig) TimeUnix(ts int64) string
- type WebsiteConfig
Constants ¶
This section is empty.
Variables ¶
var ErrAppInitialized = errors.New("app is Initialized,should not be initialized again")
ErrAppInitialized error raised if app is initialized
var ErrAppIsInInitializingMode = errors.New("app is in initializing mode.you should turn 'Initializing' in 'config/development.toml' to false")
ErrAppIsInInitializingMode error rasied if app is in initializing mode
Functions ¶
This section is empty.
Types ¶
type DevelopmentConfig ¶
type DevelopmentConfig struct {
//Debug if app is in debug mod.
Debug bool
//Testing if app is in testing mode
Testing bool
//Profiling if app is in profiling mode
Profiling bool
//Benchmarking if app is in benchmarking mode
Benchmarking bool
//Initializing if app is Initializing.
//App should panic before serveing if Initializing setted to True.
Initializing bool
// contains filtered or unexported fields
}
DevelopmentConfig program development staus config
func (*DevelopmentConfig) GetInitializeEnv ¶
func (c *DevelopmentConfig) GetInitializeEnv(name string) string
GetInitializeEnv get registered env by name.
func (*DevelopmentConfig) MustNotInitializing ¶
func (c *DevelopmentConfig) MustNotInitializing()
MustNotInitializing panic if Initializing is true
func (*DevelopmentConfig) OnEnv ¶
func (c *DevelopmentConfig) OnEnv(envs ...string) *RegisteredEnvs
OnEnv declare env name list which will be used by initializer.
func (*DevelopmentConfig) PanicInitialized ¶
func (c *DevelopmentConfig) PanicInitialized()
PanicInitialized panic a app initialized error.
type ErrInitializingEnvIsSet ¶
type ErrInitializingEnvIsSet string
ErrInitializingEnvIsSet err raied if initializing env is set. Use ErrInitializingEnvIsSet("envname") to create new error.
func (ErrInitializingEnvIsSet) Error ¶
func (e ErrInitializingEnvIsSet) Error() string
type RegisteredEnvs ¶
type RegisteredEnvs struct {
// contains filtered or unexported fields
}
RegisteredEnvs registered env name list
func (*RegisteredEnvs) ThenInitalize ¶
func (e *RegisteredEnvs) ThenInitalize(handler func() bool) []string
ThenInitalize set initalizer to registered env list.
type TimeConfig ¶
type TimeConfig struct {
//Timezone time zone.
Timezone string
//TimeFormat format used when converting time in day.
TimeFormat string
//DateFormat format used when converting date.
DateFormat string
//DatetimeFormata format used when converting date and time.
DatetimeFormat string
// contains filtered or unexported fields
}
TimeConfig app time config
func (*TimeConfig) Date ¶
func (c *TimeConfig) Date(t time.Time) string
Date format date. Panic if Timezone error.
func (*TimeConfig) DateUnix ¶
func (c *TimeConfig) DateUnix(ts int64) string
DateUnix format date from unix timestamp
func (*TimeConfig) Datetime ¶
func (c *TimeConfig) Datetime(t time.Time) string
Datetime format date and time
func (*TimeConfig) DatetimeUnix ¶
func (c *TimeConfig) DatetimeUnix(ts int64) string
DatetimeUnix format date and time from unix timestamp Panic if Timezone error.
func (*TimeConfig) Parse ¶
func (c *TimeConfig) Parse(s string) (time.Time, error)
Parse time string to local time. Panic if Timezone error.
func (*TimeConfig) TimeInLocation ¶
func (c *TimeConfig) TimeInLocation(t time.Time) time.Time
TimeInLocation set time location to given time zone. Panic if Timezone error.
func (*TimeConfig) TimeUnix ¶
func (c *TimeConfig) TimeUnix(ts int64) string
TimeUnix format time from unix timestamp
type WebsiteConfig ¶
type WebsiteConfig struct {
//Name website name.
Name string
//Description website description.
//Description should be set to meta description.
Description string
//Keywords website Keywords
//Keywords should be set to meta keywords.
Keywords string
//Email admin email.
Email string
//Homepage homepage url.
Homepage string
}
WebsiteConfig common website config