Documentation ¶
Index ¶
- Constants
- func ApiGetSpaConfig(ctx server.Context)
- func FormatPageTheme(configs []SpaConfigInfo) (mapConfigs map[string]interface{})
- func Init(opts ...OptionFunc)
- func Router(p server.Router)
- type ConfigCategory
- type ConfigContentType
- type OptionFunc
- type SpaConfig
- type SpaConfigInfo
- type SpaResp
- type WebSite
- type WebSiteInfo
- type WebSiteName
Constants ¶
View Source
const ( CategoryConfigFile = "config_file" CategoryDatabase = "config_db" CategoryRedis = "config_redis" )
Variables ¶
This section is empty.
Functions ¶
func ApiGetSpaConfig ¶ added in v1.14.0
ApiGetSpaConfig 开放接口:获取页面主题配置。
func FormatPageTheme ¶ added in v1.14.0
func FormatPageTheme(configs []SpaConfigInfo) (mapConfigs map[string]interface{})
FormatPageTheme 格式化->map
func Init ¶ added in v1.14.0
func Init(opts ...OptionFunc)
Types ¶
type ConfigCategory ¶ added in v1.14.0
type ConfigCategory string
ConfigCategory 配置类型: file/db/redis/...
type ConfigContentType ¶ added in v1.14.0
type ConfigContentType string
const ( BooleanConfigContentType ConfigContentType = "boolean" NumberConfigContentType ConfigContentType = "int" StringConfigContentType ConfigContentType = "string" )
type OptionFunc ¶ added in v1.14.0
type OptionFunc func()
func WithConfigFile ¶ added in v1.14.0
func WithConfigFile(c WebSiteInfo) OptionFunc
func WithDatabase ¶ added in v1.14.0
func WithDatabase() OptionFunc
func WithName ¶ added in v1.14.0
func WithName(name string) OptionFunc
func WithRedis ¶ added in v1.14.0
func WithRedis() OptionFunc
type SpaConfig ¶ added in v1.14.0
type SpaConfig struct { Id int `orm:"pk;auto;column(id)"` Name WebSiteName `orm:"column(app_name);"` //应用名称 ConfigName string `orm:"column(config_name);"` //配置字段名称 ConfigContent string `orm:"column(config_content);default()"` //配置字段内容 ConfigContentType string `orm:"column(config_content_Type);default(string)"` //配置字段内容类型 CreateTime time.Time `orm:"auto_now_add;type(datetime);column(ctime)"` }
SpaConfig SPA一般由vite控制, 使用localstorage管理数据
func (*SpaConfig) TableUnique ¶ added in v1.14.0
TableUnique 联合唯一约束
type SpaConfigInfo ¶ added in v1.14.0
type SpaConfigInfo struct { Id int `json:"id,omitempty"` Name string `json:"name,omitempty"` ConfigPage string `json:"configPage,omitempty"` ConfigName string `json:"configName,omitempty"` ConfigContent interface{} `json:"configContent,omitempty"` ConfigContentType string `json:"configContentType,omitempty"` }
func GetPageTheme ¶ added in v1.14.0
func GetPageTheme() (configs []SpaConfigInfo)
GetPageTheme 开放方法:获取页面主题配置。从缓存中获取
func GetPageThemeSkipCache ¶ added in v1.14.0
func GetPageThemeSkipCache() (configs []SpaConfigInfo)
GetPageThemeSkipCache 开放方法:获取页面主题配置。跳过缓存
type SpaResp ¶ added in v1.14.0
type SpaResp struct { Code interface{} `json:"code,omitempty"` Message string `json:"message,omitempty"` Data interface{} `json:"data,omitempty"` }
type WebSite ¶
type WebSite struct { app.Pk Name WebSiteName `orm:"column(name)"` // 应用名称 BaseUrl string `orm:"column(base_url)"` // url前缀 Copyright string `orm:"column(copyright)"` // 版权 Icp string `orm:"column(icp)"` // icp Favicon string `orm:"column(favicon)"` // favicon url Logo string `orm:"column(logo)"` // logo名称 Attr1 string `orm:"column(attr1)"` // 扩展 Attr2 string `orm:"column(attr2)"` // 扩展 Attr3 string `orm:"column(attr3)"` // 扩展 app.TableChangeInfo }
WebSite 网站程序配置, 动态html输出
type WebSiteInfo ¶
type WebSiteInfo struct { Name WebSiteName // 应用名称 BaseUrl string // url前缀 Copyright string // 版权 Icp string // icp Favicon string // favicon url Logo string // logo名称 Attr1 string // 扩展内容 Attr2 string // 扩展内容 Attr3 string // 扩展内容 }
func GetWebsiteInfo ¶ added in v1.14.0
func GetWebsiteInfo() (ws WebSiteInfo, err error)
type WebSiteName ¶
type WebSiteName string
Click to show internal directories.
Click to hide internal directories.