Documentation ¶
Index ¶
- Constants
- func AssertPrefix() string
- func GetAccessLogOff() bool
- func GetAccessLogPath() string
- func GetAllowDelOperationLog() bool
- func GetAppID() string
- func GetAssetRootPath() string
- func GetAssetUrl() string
- func GetAuthUserTable() string
- func GetColorScheme() string
- func GetCustom403HTML() template.HTML
- func GetCustom404HTML() template.HTML
- func GetCustom500HTML() template.HTML
- 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 GetOperationLogOff() bool
- func GetSessionLifeTime() int
- func GetSiteOff() bool
- func GetSqlLog() bool
- func GetTheme() string
- func GetTitle() string
- func GetUrlPrefix() string
- func IsNotProductionEnvironment() bool
- 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) IsAllowConfigModification() bool
- func (c *Config) IsLocalEnvironment() bool
- func (c *Config) IsNotProductionEnvironment() 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 URLFormat
- 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.24
func AssertPrefix() string
AssertPrefix return the prefix of assert.
func GetAccessLogOff ¶ added in v1.2.24
func GetAccessLogOff() bool
func GetAccessLogPath ¶ added in v1.2.24
func GetAccessLogPath() string
func GetAllowDelOperationLog ¶ added in v1.2.24
func GetAllowDelOperationLog() bool
func GetAssetRootPath ¶ added in v1.2.24
func GetAssetRootPath() string
func GetAssetUrl ¶ added in v1.2.24
func GetAssetUrl() string
func GetAuthUserTable ¶ added in v1.2.24
func GetAuthUserTable() string
func GetColorScheme ¶ added in v1.2.24
func GetColorScheme() string
func GetCustom403HTML ¶ added in v1.2.24
func GetCustom404HTML ¶ added in v1.2.24
func GetCustom500HTML ¶ added in v1.2.24
func GetCustomFootHtml ¶ added in v1.2.24
func GetCustomHeadHtml ¶ added in v1.2.24
func GetErrorLogOff ¶ added in v1.2.24
func GetErrorLogOff() bool
func GetErrorLogPath ¶ added in v1.2.24
func GetErrorLogPath() string
func GetExcludeThemeComponents ¶ added in v1.2.24
func GetExcludeThemeComponents() []string
func GetFooterInfo ¶ added in v1.2.24
func GetHideVisitorUserCenterEntrance ¶ added in v1.2.24
func GetHideVisitorUserCenterEntrance() bool
func GetIndexURL ¶ added in v1.2.24
func GetIndexURL() string
GetIndexURL get the index url with prefix.
func GetIndexUrl ¶ added in v1.2.24
func GetIndexUrl() string
func GetInfoLogOff ¶ added in v1.2.24
func GetInfoLogOff() bool
func GetInfoLogPath ¶ added in v1.2.24
func GetInfoLogPath() string
func GetLanguage ¶ added in v1.2.24
func GetLanguage() string
func GetLoginLogo ¶ added in v1.2.24
func GetLoginTitle ¶ added in v1.2.24
func GetLoginTitle() string
func GetLoginUrl ¶ added in v1.2.24
func GetLoginUrl() string
func GetMiniLogo ¶ added in v1.2.24
func GetNoLimitLoginIP ¶ added in v1.2.24
func GetNoLimitLoginIP() bool
func GetOpenAdminApi ¶ added in v1.2.24
func GetOpenAdminApi() bool
func GetOperationLogOff ¶ added in v1.2.24
func GetOperationLogOff() bool
func GetSessionLifeTime ¶ added in v1.2.24
func GetSessionLifeTime() int
func GetSiteOff ¶ added in v1.2.24
func GetSiteOff() bool
func GetUrlPrefix ¶ added in v1.2.24
func GetUrlPrefix() string
func IsNotProductionEnvironment ¶ added in v1.2.24
func IsNotProductionEnvironment() bool
IsNotProductionEnvironment check the environment if it is not production.
func IsProductionEnvironment ¶ added in v1.2.24
func IsProductionEnvironment() bool
IsProductionEnvironment check the environment if it is production.
func PrefixFixSlash ¶ added in v1.2.24
func PrefixFixSlash() string
PrefixFixSlash return the prefix fix the slash error.
func URLRemovePrefix ¶ added in v1.2.24
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,omitempty" yaml:"database,omitempty" ini:"database,omitempty"` // The application unique ID. Once generated, don't modify. AppID string `json:"app_id,omitempty" yaml:"app_id,omitempty" ini:"app_id,omitempty"` // The cookie domain used in the auth modules. see // the session.go. Domain string `json:"domain,omitempty" yaml:"domain,omitempty" ini:"domain,omitempty"` // Used to set as the localize language which show in the // interface. Language string `json:"language,omitempty" yaml:"language,omitempty" ini:"language,omitempty"` // The global url prefix. UrlPrefix string `json:"prefix,omitempty" yaml:"prefix,omitempty" ini:"prefix,omitempty"` // The theme name of template. Theme string `json:"theme,omitempty" yaml:"theme,omitempty" ini:"theme,omitempty"` // The path where files will be stored into. Store Store `json:"store,omitempty" yaml:"store,omitempty" ini:"store,omitempty"` // The title of web page. Title string `json:"title,omitempty" yaml:"title,omitempty" ini:"title,omitempty"` // Logo is the top text in the sidebar. Logo template.HTML `json:"logo,omitempty" yaml:"logo,omitempty" ini:"logo,omitempty"` // Mini-logo is the top text in the sidebar when folding. MiniLogo template.HTML `json:"mini_logo,omitempty" yaml:"mini_logo,omitempty" ini:"mini_logo,omitempty"` // The url redirect to after login. IndexUrl string `json:"index,omitempty" yaml:"index,omitempty" ini:"index,omitempty"` // Login page URL LoginUrl string `json:"login_url,omitempty" yaml:"login_url,omitempty" ini:"login_url,omitempty"` // Debug mode Debug bool `json:"debug,omitempty" yaml:"debug,omitempty" ini:"debug,omitempty"` // Env is the environment,which maybe local,test,prod. Env string `json:"env,omitempty" yaml:"env,omitempty" ini:"env,omitempty"` // Info log path. InfoLogPath string `json:"info_log,omitempty" yaml:"info_log,omitempty" ini:"info_log,omitempty"` // Error log path. ErrorLogPath string `json:"error_log,omitempty" yaml:"error_log,omitempty" ini:"error_log,omitempty"` // Access log path. AccessLogPath string `json:"access_log,omitempty" yaml:"access_log,omitempty" ini:"access_log,omitempty"` // Access assets log off AccessAssetsLogOff bool `json:"access_assets_log_off,omitempty" yaml:"access_assets_log_off,omitempty" ini:"access_assets_log_off,omitempty"` // Sql operator record log switch. SqlLog bool `json:"sql_log,omitempty" yaml:"sql_log,omitempty" ini:"sql_log,omitempty"` AccessLogOff bool `json:"access_log_off,omitempty" yaml:"access_log_off,omitempty" ini:"access_log_off,omitempty"` InfoLogOff bool `json:"info_log_off,omitempty" yaml:"info_log_off,omitempty" ini:"info_log_off,omitempty"` ErrorLogOff bool `json:"error_log_off,omitempty" yaml:"error_log_off,omitempty" ini:"error_log_off,omitempty"` Logger Logger `json:"logger,omitempty" yaml:"logger,omitempty" ini:"logger,omitempty"` // Color scheme. ColorScheme string `json:"color_scheme,omitempty" yaml:"color_scheme,omitempty" ini:"color_scheme,omitempty"` // Session valid time duration,units are seconds. Default 7200. SessionLifeTime int `json:"session_life_time,omitempty" yaml:"session_life_time,omitempty" ini:"session_life_time,omitempty"` // Assets visit link. AssetUrl string `json:"asset_url,omitempty" yaml:"asset_url,omitempty" ini:"asset_url,omitempty"` // File upload engine,default "local" FileUploadEngine FileUploadEngine `json:"file_upload_engine,omitempty" yaml:"file_upload_engine,omitempty" ini:"file_upload_engine,omitempty"` // Custom html in the tag head. CustomHeadHtml template.HTML `json:"custom_head_html,omitempty" yaml:"custom_head_html,omitempty" ini:"custom_head_html,omitempty"` // Custom html after body. CustomFootHtml template.HTML `json:"custom_foot_html,omitempty" yaml:"custom_foot_html,omitempty" ini:"custom_foot_html,omitempty"` FooterInfo template.HTML `json:"footer_info,omitempty" yaml:"footer_info,omitempty" ini:"footer_info,omitempty"` // Login page title LoginTitle string `json:"login_title,omitempty" yaml:"login_title,omitempty" ini:"login_title,omitempty"` // Login page logo LoginLogo template.HTML `json:"login_logo,omitempty" yaml:"login_logo,omitempty" ini:"login_logo,omitempty"` // Auth user table AuthUserTable string `json:"auth_user_table,omitempty" yaml:"auth_user_table,omitempty" ini:"auth_user_table,omitempty"` // Extra config info Extra ExtraInfo `json:"extra,omitempty" yaml:"extra,omitempty" ini:"extra,omitempty"` // Page animation Animation PageAnimation `json:"animation,omitempty" yaml:"animation,omitempty" ini:"animation,omitempty"` // Limit login with different IPs NoLimitLoginIP bool `json:"no_limit_login_ip,omitempty" yaml:"no_limit_login_ip,omitempty" ini:"no_limit_login_ip,omitempty"` // When site off is true, website will be closed SiteOff bool `json:"site_off,omitempty" yaml:"site_off,omitempty" ini:"site_off,omitempty"` // Hide config center entrance flag HideConfigCenterEntrance bool `` /* 133-byte string literal not displayed */ // Prohibit config modification ProhibitConfigModification bool `` /* 136-byte string literal not displayed */ // Hide app info entrance flag HideAppInfoEntrance bool `json:"hide_app_info_entrance,omitempty" yaml:"hide_app_info_entrance,omitempty" ini:"hide_app_info_entrance,omitempty"` // Hide tool entrance flag HideToolEntrance bool `json:"hide_tool_entrance,omitempty" yaml:"hide_tool_entrance,omitempty" ini:"hide_tool_entrance,omitempty"` HidePluginEntrance bool `json:"hide_plugin_entrance,omitempty" yaml:"hide_plugin_entrance,omitempty" ini:"hide_plugin_entrance,omitempty"` Custom404HTML template.HTML `json:"custom_404_html,omitempty" yaml:"custom_404_html,omitempty" ini:"custom_404_html,omitempty"` Custom403HTML template.HTML `json:"custom_403_html,omitempty" yaml:"custom_403_html,omitempty" ini:"custom_403_html,omitempty"` Custom500HTML template.HTML `json:"custom_500_html,omitempty" yaml:"custom_500_html,omitempty" ini:"custom_500_html,omitempty"` // Update Process Function UpdateProcessFn UpdateConfigProcessFn `json:"-" yaml:"-" ini:"-"` // Is open admin plugin json api OpenAdminApi bool `json:"open_admin_api,omitempty" yaml:"open_admin_api,omitempty" ini:"open_admin_api,omitempty"` HideVisitorUserCenterEntrance bool `` /* 151-byte string literal not displayed */ ExcludeThemeComponents []string `json:"exclude_theme_components,omitempty" yaml:"exclude_theme_components,omitempty" ini:"exclude_theme_components,omitempty"` BootstrapFilePath string `json:"bootstrap_file_path,omitempty" yaml:"bootstrap_file_path,omitempty" ini:"bootstrap_file_path,omitempty"` GoModFilePath string `json:"go_mod_file_path,omitempty" yaml:"go_mod_file_path,omitempty" ini:"go_mod_file_path,omitempty"` AllowDelOperationLog bool `json:"allow_del_operation_log,omitempty" yaml:"allow_del_operation_log,omitempty" ini:"allow_del_operation_log,omitempty"` OperationLogOff bool `json:"operation_log_off,omitempty" yaml:"operation_log_off,omitempty" ini:"operation_log_off,omitempty"` AssetRootPath string `json:"asset_root_path,omitempty" yaml:"asset_root_path,omitempty" ini:"asset_root_path,omitempty"` URLFormat URLFormat `json:"url_format,omitempty" yaml:"url_format,omitempty" ini:"url_format,omitempty"` // 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.24
func GetService(s interface{}) *Config
func Initialize ¶ added in v1.2.24
Initialize initialize the config.
func ReadFromINI ¶ added in v1.2.24
ReadFromINI read the Config from a INI file.
func ReadFromJson ¶ added in v1.2.24
ReadFromJson read the Config from a JSON file.
func ReadFromYaml ¶ added in v1.2.24
ReadFromYaml read the Config from a YAML file.
func SetDefault ¶ added in v1.2.24
func (*Config) AddUpdateProcessFn ¶ added in v1.2.24
func (c *Config) AddUpdateProcessFn(fn UpdateConfigProcessFn) *Config
func (*Config) AssertPrefix ¶ added in v1.2.24
AssertPrefix return the prefix of assert.
func (*Config) GetIndexURL ¶ added in v1.2.24
GetIndexURL get the index url with prefix.
func (*Config) IsAllowConfigModification ¶ added in v1.2.24
func (*Config) IsLocalEnvironment ¶ added in v1.2.24
IsLocalEnvironment check the environment if it is local.
func (*Config) IsNotProductionEnvironment ¶ added in v1.2.24
IsNotProductionEnvironment check the environment if it is not production.
func (*Config) IsProductionEnvironment ¶ added in v1.2.24
IsProductionEnvironment check the environment if it is production.
func (*Config) IsTestEnvironment ¶ added in v1.2.24
IsTestEnvironment check the environment if it is test.
func (*Config) PrefixFixSlash ¶ added in v1.2.24
PrefixFixSlash return the prefix fix the slash error.
func (*Config) URLRemovePrefix ¶ added in v1.2.24
URLRemovePrefix remove prefix from the given url.
type Database ¶
type Database struct { Host string `json:"host,omitempty" yaml:"host,omitempty" ini:"host,omitempty"` Port string `json:"port,omitempty" yaml:"port,omitempty" ini:"port,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty" ini:"user,omitempty"` Pwd string `json:"pwd,omitempty" yaml:"pwd,omitempty" ini:"pwd,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty" ini:"name,omitempty"` MaxIdleCon int `json:"max_idle_con,omitempty" yaml:"max_idle_con,omitempty" ini:"max_idle_con,omitempty"` MaxOpenCon int `json:"max_open_con,omitempty" yaml:"max_open_con,omitempty" ini:"max_open_con,omitempty"` Driver string `json:"driver,omitempty" yaml:"driver,omitempty" ini:"driver,omitempty"` DriverMode string `json:"driver_mode,omitempty" yaml:"driver_mode,omitempty" ini:"driver_mode,omitempty"` File string `json:"file,omitempty" yaml:"file,omitempty" ini:"file,omitempty"` Dsn string `json:"dsn,omitempty" yaml:"dsn,omitempty" ini:"dsn,omitempty"` Params map[string]string `json:"params,omitempty" yaml:"params,omitempty" ini:"params,omitempty"` }
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.2.24
DatabaseList is a map of Database.
func GetDatabaseListFromJSON ¶ added in v1.2.24
func GetDatabaseListFromJSON(m string) DatabaseList
func GetDatabases ¶ added in v1.2.24
func GetDatabases() DatabaseList
func (DatabaseList) Add ¶ added in v1.2.24
func (d DatabaseList) Add(key string, db Database)
Add add a Database to the DatabaseList.
func (DatabaseList) Connections ¶ added in v1.2.24
func (d DatabaseList) Connections() []string
func (DatabaseList) Copy ¶ added in v1.2.24
func (d DatabaseList) Copy() DatabaseList
func (DatabaseList) GetDefault ¶ added in v1.2.24
func (d DatabaseList) GetDefault() Database
GetDefault get the default Database.
func (DatabaseList) GroupByDriver ¶ added in v1.2.24
func (d DatabaseList) GroupByDriver() map[string]DatabaseList
GroupByDriver group the Databases with the drivers.
func (DatabaseList) JSON ¶ added in v1.2.24
func (d DatabaseList) JSON() string
type EncoderCfg ¶ added in v1.2.24
type EncoderCfg struct { TimeKey string `json:"time_key,omitempty" yaml:"time_key,omitempty" ini:"time_key,omitempty"` LevelKey string `json:"level_key,omitempty" yaml:"level_key,omitempty" ini:"level_key,omitempty"` NameKey string `json:"name_key,omitempty" yaml:"name_key,omitempty" ini:"name_key,omitempty"` CallerKey string `json:"caller_key,omitempty" yaml:"caller_key,omitempty" ini:"caller_key,omitempty"` MessageKey string `json:"message_key,omitempty" yaml:"message_key,omitempty" ini:"message_key,omitempty"` StacktraceKey string `json:"stacktrace_key,omitempty" yaml:"stacktrace_key,omitempty" ini:"stacktrace_key,omitempty"` Level string `json:"level,omitempty" yaml:"level,omitempty" ini:"level,omitempty"` Time string `json:"time,omitempty" yaml:"time,omitempty" ini:"time,omitempty"` Duration string `json:"duration,omitempty" yaml:"duration,omitempty" ini:"duration,omitempty"` Caller string `json:"caller,omitempty" yaml:"caller,omitempty" ini:"caller,omitempty"` Encoding string `json:"encoding,omitempty" yaml:"encoding,omitempty" ini:"encoding,omitempty"` }
type FileUploadEngine ¶ added in v1.2.24
type FileUploadEngine struct { Name string `json:"name,omitempty" yaml:"name,omitempty" ini:"name,omitempty"` Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty" ini:"config,omitempty"` }
FileUploadEngine is a file upload engine.
func GetFileUploadEngine ¶ added in v1.2.24
func GetFileUploadEngine() FileUploadEngine
func GetFileUploadEngineFromJSON ¶ added in v1.2.24
func GetFileUploadEngineFromJSON(m string) FileUploadEngine
func (FileUploadEngine) JSON ¶ added in v1.2.24
func (f FileUploadEngine) JSON() string
type Logger ¶ added in v1.2.24
type Logger struct { Encoder EncoderCfg `json:"encoder,omitempty" yaml:"encoder,omitempty" ini:"encoder,omitempty"` Rotate RotateCfg `json:"rotate,omitempty" yaml:"rotate,omitempty" ini:"rotate,omitempty"` Level int8 `json:"level,omitempty" yaml:"level,omitempty" ini:"level,omitempty"` }
type PageAnimation ¶ added in v1.2.24
type PageAnimation struct { Type string `json:"type,omitempty" yaml:"type,omitempty" ini:"type,omitempty"` Duration float32 `json:"duration,omitempty" yaml:"duration,omitempty" ini:"duration,omitempty"` Delay float32 `json:"delay,omitempty" yaml:"delay,omitempty" ini:"delay,omitempty"` }
see more: https://daneden.github.io/animate.css/
func GetAnimation ¶ added in v1.2.24
func GetAnimation() PageAnimation
func (PageAnimation) JSON ¶ added in v1.2.24
func (p PageAnimation) JSON() string
type RotateCfg ¶ added in v1.2.24
type RotateCfg struct { MaxSize int `json:"max_size,omitempty" yaml:"max_size,omitempty" ini:"max_size,omitempty"` MaxBackups int `json:"max_backups,omitempty" yaml:"max_backups,omitempty" ini:"max_backups,omitempty"` MaxAge int `json:"max_age,omitempty" yaml:"max_age,omitempty" ini:"max_age,omitempty"` Compress bool `json:"compress,omitempty" yaml:"compress,omitempty" ini:"compress,omitempty"` }
type Service ¶ added in v1.2.24
type Service struct {
C *Config
}
func SrvWithConfig ¶ added in v1.2.24
type Store ¶
type Store struct { Path string `json:"path,omitempty" yaml:"path,omitempty" ini:"path,omitempty"` Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty" ini:"prefix,omitempty"` }
Store is the file store config. Path is the local store path. and prefix is the url prefix used to visit it.
func GetStoreFromJSON ¶ added in v1.2.24
type URLFormat ¶ added in v1.2.24
type URLFormat struct { Info string `json:"info,omitempty" yaml:"info,omitempty" ini:"info,omitempty"` Detail string `json:"detail,omitempty" yaml:"detail,omitempty" ini:"detail,omitempty"` Create string `json:"create,omitempty" yaml:"create,omitempty" ini:"create,omitempty"` Delete string `json:"delete,omitempty" yaml:"delete,omitempty" ini:"delete,omitempty"` Export string `json:"export,omitempty" yaml:"export,omitempty" ini:"export,omitempty"` Edit string `json:"edit,omitempty" yaml:"edit,omitempty" ini:"edit,omitempty"` ShowEdit string `json:"show_edit,omitempty" yaml:"show_edit,omitempty" ini:"show_edit,omitempty"` ShowCreate string `json:"show_create,omitempty" yaml:"show_create,omitempty" ini:"show_create,omitempty"` Update string `json:"update,omitempty" yaml:"update,omitempty" ini:"update,omitempty"` }
func GetURLFormats ¶ added in v1.2.24
func GetURLFormats() URLFormat