Documentation ¶
Index ¶
- Constants
- func AssertPrefix() string
- func GetAccessLogOff() bool
- func GetAccessLogPath() string
- func GetAssetUrl() string
- func GetAuthUserTable() string
- func GetColorScheme() string
- func GetCustomFootHtml() template.HTML
- func GetCustomHeadHtml() template.HTML
- func GetDebug() bool
- func GetDomain() string
- func GetEnv() string
- func GetErrorLogOff() bool
- func GetErrorLogPath() string
- func GetExcludeThemeComponents() []string
- func GetExtra() map[string]interface{}
- func GetFooterInfo() template.HTML
- func GetHideVisitorUserCenterEntrance() bool
- func GetIndexURL() string
- func GetIndexUrl() string
- func GetInfoLogOff() bool
- func GetInfoLogPath() string
- func GetLanguage() string
- func GetLoginLogo() template.HTML
- func GetLoginTitle() string
- func GetLoginUrl() string
- func GetLogo() template.HTML
- func GetMiniLogo() template.HTML
- func GetNoLimitLoginIP() bool
- func GetOpenAdminApi() bool
- func GetSessionLifeTime() int
- func GetSiteOff() bool
- func GetSqlLog() bool
- func GetTheme() string
- func GetTitle() string
- func GetUrlPrefix() string
- func IsProductionEnvironment() bool
- func Prefix() string
- func PrefixFixSlash() string
- func URLRemovePrefix(url string) string
- func Url(suffix string) string
- type Config
- func (c *Config) AddUpdateProcessFn(fn UpdateConfigProcessFn) *Config
- func (c *Config) AssertPrefix() string
- func (c *Config) Copy() *Config
- func (c *Config) EraseSens() *Config
- func (c *Config) GetIndexURL() string
- func (c *Config) Index() string
- func (c *Config) IsLocalEnvironment() bool
- func (c *Config) IsProductionEnvironment() bool
- func (c *Config) IsTestEnvironment() bool
- func (c *Config) Prefix() string
- func (c *Config) PrefixFixSlash() string
- func (c *Config) ToMap() map[string]string
- func (c *Config) URLRemovePrefix(url string) string
- func (c *Config) Update(m map[string]string) error
- func (c *Config) Url(suffix string) string
- type Database
- type DatabaseList
- type EncoderCfg
- type ExtraInfo
- type FileUploadEngine
- type Logger
- type PageAnimation
- type RotateCfg
- type Service
- type Store
- type UpdateConfigProcessFn
Constants ¶
const ( // EnvTest is a const value of test environment. EnvTest = "test" // EnvLocal is a const value of local environment. EnvLocal = "local" // EnvProd is a const value of production environment. EnvProd = "prod" // DriverMysql is a const value of mysql driver. DriverMysql = "mysql" // DriverSqlite is a const value of sqlite driver. DriverSqlite = "sqlite" // DriverPostgresql is a const value of postgresql driver. DriverPostgresql = "postgresql" // DriverMssql is a const value of mssql driver. DriverMssql = "mssql" )
Variables ¶
This section is empty.
Functions ¶
func AssertPrefix ¶ added in v1.2.8
func AssertPrefix() string
AssertPrefix return the prefix of assert.
func GetAccessLogOff ¶ added in v1.2.8
func GetAccessLogOff() bool
func GetAccessLogPath ¶ added in v1.2.8
func GetAccessLogPath() string
func GetAssetUrl ¶ added in v1.2.8
func GetAssetUrl() string
func GetAuthUserTable ¶ added in v1.2.8
func GetAuthUserTable() string
func GetColorScheme ¶ added in v1.2.8
func GetColorScheme() string
func GetCustomFootHtml ¶ added in v1.2.8
func GetCustomHeadHtml ¶ added in v1.2.8
func GetErrorLogOff ¶ added in v1.2.8
func GetErrorLogOff() bool
func GetErrorLogPath ¶ added in v1.2.8
func GetErrorLogPath() string
func GetExcludeThemeComponents ¶ added in v1.2.10
func GetExcludeThemeComponents() []string
func GetFooterInfo ¶ added in v1.2.8
func GetHideVisitorUserCenterEntrance ¶ added in v1.2.10
func GetHideVisitorUserCenterEntrance() bool
func GetIndexURL ¶ added in v1.2.8
func GetIndexURL() string
GetIndexURL get the index url with prefix.
func GetIndexUrl ¶ added in v1.2.8
func GetIndexUrl() string
func GetInfoLogOff ¶ added in v1.2.8
func GetInfoLogOff() bool
func GetInfoLogPath ¶ added in v1.2.8
func GetInfoLogPath() string
func GetLanguage ¶ added in v1.2.8
func GetLanguage() string
func GetLoginLogo ¶ added in v1.2.8
func GetLoginTitle ¶ added in v1.2.8
func GetLoginTitle() string
func GetLoginUrl ¶ added in v1.2.8
func GetLoginUrl() string
func GetMiniLogo ¶ added in v1.2.8
func GetNoLimitLoginIP ¶ added in v1.2.8
func GetNoLimitLoginIP() bool
func GetOpenAdminApi ¶ added in v1.2.8
func GetOpenAdminApi() bool
func GetSessionLifeTime ¶ added in v1.2.8
func GetSessionLifeTime() int
func GetSiteOff ¶ added in v1.2.8
func GetSiteOff() bool
func GetUrlPrefix ¶ added in v1.2.8
func GetUrlPrefix() string
func IsProductionEnvironment ¶ added in v1.2.8
func IsProductionEnvironment() bool
IsProductionEnvironment check the environment if it is production.
func PrefixFixSlash ¶ added in v1.2.8
func PrefixFixSlash() string
PrefixFixSlash return the prefix fix the slash error.
func URLRemovePrefix ¶ added in v1.2.8
URLRemovePrefix remove prefix from the given url.
Types ¶
type Config ¶
type Config struct { // An map supports multi database connection. The first // element of Databases is the default connection. See the // file connection.go. Databases DatabaseList `json:"database",yaml:"database",ini:"database"` // The cookie domain used in the auth modules. see // the session.go. Domain string `json:"domain",yaml:"domain",ini:"domain"` // Used to set as the localize language which show in the // interface. Language string `json:"language",yaml:"language",ini:"language"` // The global url prefix. UrlPrefix string `json:"prefix",yaml:"prefix",ini:"prefix"` // The theme name of template. Theme string `json:"theme",yaml:"theme",ini:"theme"` // The path where files will be stored into. Store Store `json:"store",yaml:"store",ini:"store"` // The title of web page. Title string `json:"title",yaml:"title",ini:"title"` // Logo is the top text in the sidebar. Logo template.HTML `json:"logo",yaml:"logo",ini:"logo"` // Mini-logo is the top text in the sidebar when folding. MiniLogo template.HTML `json:"mini_logo",yaml:"mini_logo",ini:"mini_logo"` // The url redirect to after login. IndexUrl string `json:"index",yaml:"index",ini:"index"` // Login page URL LoginUrl string `json:"login_url",yaml:"login_url",ini:"login_url"` // Debug mode Debug bool `json:"debug",yaml:"debug",ini:"debug"` // Env is the environment,which maybe local,test,prod. Env string `json:"env",yaml:"env",ini:"env"` // Info log path. InfoLogPath string `json:"info_log",yaml:"info_log",ini:"info_log"` // Error log path. ErrorLogPath string `json:"error_log",yaml:"error_log",ini:"error_log"` // Access log path. AccessLogPath string `json:"access_log",yaml:"access_log",ini:"access_log"` // Access assets log off AccessAssetsLogOff bool `json:"access_assets_log_off",yaml:"access_assets_log_off",ini:"access_assets_log_off"` // Sql operator record log switch. SqlLog bool `json:"sql_log",yaml:"sql_log",ini:"sql_log"` AccessLogOff bool `json:"access_log_off",yaml:"access_log_off",ini:"access_log_off"` InfoLogOff bool `json:"info_log_off",yaml:"info_log_off",ini:"info_log_off"` ErrorLogOff bool `json:"error_log_off",yaml:"error_log_off",ini:"error_log_off"` Logger Logger `json:"logger",yaml:"logger",ini:"logger"` // Color scheme. ColorScheme string `json:"color_scheme",yaml:"color_scheme",ini:"color_scheme"` // Session valid time duration,units are seconds. Default 7200. SessionLifeTime int `json:"session_life_time",yaml:"session_life_time",ini:"session_life_time"` // Assets visit link. AssetUrl string `json:"asset_url",yaml:"asset_url",ini:"asset_url"` // File upload engine,default "local" FileUploadEngine FileUploadEngine `json:"file_upload_engine",yaml:"file_upload_engine",ini:"file_upload_engine"` // Custom html in the tag head. CustomHeadHtml template.HTML `json:"custom_head_html",yaml:"custom_head_html",ini:"custom_head_html"` // Custom html after body. CustomFootHtml template.HTML `json:"custom_foot_html",yaml:"custom_foot_html",ini:"custom_foot_html"` FooterInfo template.HTML `json:"footer_info",yaml:"footer_info",ini:"footer_info"` // Login page title LoginTitle string `json:"login_title",yaml:"login_title",ini:"login_title"` // Login page logo LoginLogo template.HTML `json:"login_logo",yaml:"login_logo",ini:"login_logo"` // Auth user table AuthUserTable string `json:"auth_user_table",yaml:"auth_user_table",ini:"auth_user_table"` // Extra config info Extra ExtraInfo `json:"extra",yaml:"extra",ini:"extra"` // Page animation Animation PageAnimation `json:"animation",yaml:"animation",ini:"animation"` // Limit login with different IPs NoLimitLoginIP bool `json:"no_limit_login_ip",yaml:"no_limit_login_ip",ini:"no_limit_login_ip"` // When site off is true, website will be closed SiteOff bool `json:"site_off",yaml:"site_off",ini:"site_off"` // Hide config center entrance flag HideConfigCenterEntrance bool `json:"hide_config_center_entrance",yaml:"hide_config_center_entrance",ini:"hide_config_center_entrance"` // Hide app info entrance flag HideAppInfoEntrance bool `json:"hide_app_info_entrance",yaml:"hide_app_info_entrance",ini:"hide_app_info_entrance"` // Hide tool entrance flag HideToolEntrance bool `json:"hide_tool_entrance",yaml:"hide_tool_entrance",ini:"hide_tool_entrance"` // Update Process Function UpdateProcessFn UpdateConfigProcessFn `json:"-",yaml:"-",ini:"-"` // Is open admin plugin json api OpenAdminApi bool `json:"open_admin_api",yaml:"open_admin_api",ini:"open_admin_api"` HideVisitorUserCenterEntrance bool `json:"hide_visitor_user_center_entrance",yaml:"hide_visitor_user_center_entrance",ini:"hide_visitor_user_center_entrance"` ExcludeThemeComponents []string `json:"exclude_theme_components",yaml:"exclude_theme_components",ini:"exclude_theme_components"` // contains filtered or unexported fields }
Config type is the global config of goAdmin. It will be initialized in the engine.
func GetService ¶ added in v1.2.8
func GetService(s interface{}) *Config
func ReadFromINI ¶ added in v1.1.4
ReadFromINI read the Config from a INI file.
func ReadFromJson ¶ added in v1.0.0
ReadFromJson read the Config from a JSON file.
func ReadFromYaml ¶ added in v1.1.4
ReadFromYaml read the Config from a YAML file.
func (*Config) AddUpdateProcessFn ¶ added in v1.2.8
func (c *Config) AddUpdateProcessFn(fn UpdateConfigProcessFn) *Config
func (*Config) AssertPrefix ¶ added in v1.1.4
AssertPrefix return the prefix of assert.
func (*Config) GetIndexURL ¶ added in v1.0.8
GetIndexURL get the index url with prefix.
func (*Config) IsLocalEnvironment ¶ added in v1.0.0
IsLocalEnvironment check the environment if it is local.
func (*Config) IsProductionEnvironment ¶ added in v1.0.0
IsProductionEnvironment check the environment if it is production.
func (*Config) IsTestEnvironment ¶ added in v1.0.0
IsTestEnvironment check the environment if it is test.
func (*Config) PrefixFixSlash ¶ added in v1.0.0
PrefixFixSlash return the prefix fix the slash error.
func (*Config) URLRemovePrefix ¶ added in v1.0.8
URLRemovePrefix remove prefix from the given url.
type Database ¶
type Database struct { Host string `json:"host",yaml:"host",ini:"host"` Port string `json:"port",yaml:"port",ini:"port"` User string `json:"user",yaml:"user",ini:"user"` Pwd string `json:"pwd",yaml:"pwd",ini:"pwd"` Name string `json:"name",yaml:"name",ini:"name"` MaxIdleCon int `json:"max_idle_con",yaml:"max_idle_con",ini:"max_idle_con"` MaxOpenCon int `json:"max_open_con",yaml:"max_open_con",ini:"max_open_con"` Driver string `json:"driver",yaml:"driver",ini:"driver"` File string `json:"file",yaml:"file",ini:"file"` Dsn string `json:"dsn",yaml:"dsn",ini:"dsn"` }
Database is a type of database connection config.
Because a little difference of different database driver. The Config has multiple options but may not be used. Such as the sqlite driver only use the File option which can be ignored when the driver is mysql.
If the Dsn is configured, when driver is mysql/postgresql/ mssql, the other configurations will be ignored, except for MaxIdleCon and MaxOpenCon.
type DatabaseList ¶ added in v1.0.0
DatabaseList is a map of Database.
func GetDatabaseListFromJSON ¶ added in v1.2.8
func GetDatabaseListFromJSON(m string) DatabaseList
func GetDatabases ¶ added in v1.2.8
func GetDatabases() DatabaseList
func (DatabaseList) Add ¶ added in v1.0.0
func (d DatabaseList) Add(key string, db Database)
Add add a Database to the DatabaseList.
func (DatabaseList) Connections ¶ added in v1.2.11
func (d DatabaseList) Connections() []string
func (DatabaseList) Copy ¶ added in v1.2.11
func (d DatabaseList) Copy() DatabaseList
func (DatabaseList) GetDefault ¶ added in v1.0.0
func (d DatabaseList) GetDefault() Database
GetDefault get the default Database.
func (DatabaseList) GroupByDriver ¶ added in v1.0.0
func (d DatabaseList) GroupByDriver() map[string]DatabaseList
GroupByDriver group the Databases with the drivers.
func (DatabaseList) JSON ¶ added in v1.2.8
func (d DatabaseList) JSON() string
type EncoderCfg ¶ added in v1.2.9
type EncoderCfg struct { TimeKey string `json:"time_key",yaml:"time_key",ini:"time_key"` LevelKey string `json:"level_key",yaml:"level_key",ini:"level_key"` NameKey string `json:"name_key",yaml:"name_key",ini:"name_key"` CallerKey string `json:"caller_key",yaml:"caller_key",ini:"caller_key"` MessageKey string `json:"message_key",yaml:"message_key",ini:"message_key"` StacktraceKey string `json:"stacktrace_key",yaml:"stacktrace_key",ini:"stacktrace_key"` Level string `json:"level",yaml:"level",ini:"level"` Time string `json:"time",yaml:"time",ini:"time"` Duration string `json:"duration",yaml:"duration",ini:"duration"` Caller string `json:"caller",yaml:"caller",ini:"caller"` Encoding string `json:"encoding",yaml:"encoding",ini:"encoding"` }
type FileUploadEngine ¶ added in v1.0.0
type FileUploadEngine struct { Name string `json:"name",yaml:"name",ini:"name"` Config map[string]interface{} `json:"config",yaml:"config",ini:"config"` }
FileUploadEngine is a file upload engine.
func GetFileUploadEngine ¶ added in v1.2.8
func GetFileUploadEngine() FileUploadEngine
func GetFileUploadEngineFromJSON ¶ added in v1.2.8
func GetFileUploadEngineFromJSON(m string) FileUploadEngine
func (FileUploadEngine) JSON ¶ added in v1.2.8
func (f FileUploadEngine) JSON() string
type Logger ¶ added in v1.2.9
type Logger struct { Encoder EncoderCfg `json:"encoder",yaml:"encoder",ini:"encoder"` Rotate RotateCfg `json:"rotate",yaml:"rotate",ini:"rotate"` Level int8 `json:"level",yaml:"level",ini:"level"` }
type PageAnimation ¶ added in v1.2.4
type PageAnimation struct { Type string `json:"type",yaml:"type",ini:"type"` Duration float32 `json:"duration",yaml:"duration",ini:"duration"` Delay float32 `json:"delay",yaml:"delay",ini:"delay"` }
see more: https://daneden.github.io/animate.css/
func GetAnimation ¶ added in v1.2.8
func GetAnimation() PageAnimation
func GetPageAnimationFromJSON ¶ added in v1.2.8
func GetPageAnimationFromJSON(m string) PageAnimation
func (PageAnimation) JSON ¶ added in v1.2.8
func (p PageAnimation) JSON() string
type Service ¶ added in v1.2.8
type Service struct {
C *Config
}