Documentation ¶
Index ¶
- func APIGETConfig(c *gin.Context)
- func Authorization() gin.HandlerFunc
- func CORS() gin.HandlerFunc
- func GetTablePrefix(dbID string) string
- func HTMLRender() render.HTMLRender
- func Register(path ...string) error
- func SetDatabases() (err error)
- func SetGin()
- func SetLog()
- type CORSConfig
- type Config
- type Database
- type Databases
- type Gin
- type KV
- type KVS
- type SQL
- type Static
- type System
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIGETConfig ¶ added in v0.0.5
APIGETConfig 返回系统配置项 @since 0.0.4
func Authorization ¶ added in v0.0.11
func Authorization() gin.HandlerFunc
func CORS ¶ added in v0.0.10
func CORS() gin.HandlerFunc
CORS returns the location middleware with default configuration. @since v0.0.9
func GetTablePrefix ¶ added in v0.0.5
Types ¶
type CORSConfig ¶ added in v0.0.11
type CORSConfig struct { AllowOrigins []string `json:"allow-origins"` AllowMethods []string `json:"allow-methods"` AllowHeaders []string `json:"allow-headers"` }
@since 0.0.10 增加跨域的配置项
type Config ¶
type Config struct { Databases Databases `json:"databases"` System System `json:"system"` Gin Gin `json:"gin"` SQL SQL `json:"sql"` // @since 0.0.10 CORS CORSConfig `json:"cors"` // @since 0.0.11 KV KVS `json:"kv"` }
Config 配置 @since 0.0.10 增加跨域功能
var ( // Conf 配置 Conf *Config // DefConf 默认配置 DefConf Config // Cookie 配置 // @since 0.0.2 Cookie = cookie{ MaxAge: 1 * 60 * 60, Path: "/", Domain: "", Secure: false, HTTPOnly: false, } )
@since 0.0.1
func DefaultConf ¶
func DefaultConf() Config
DefaultConf 默认配置 这里待考虑 是写在内存里还是流出配置文件 考虑的结果是为了防止文件缺失的问题写到内存里 conf.default.json 依旧在包里供查阅 @since 0.0.1
type Database ¶
type Database struct { DBID string `json:"db_id"` Driver string `json:"driver"` Name string `json:"name"` User string `json:"user"` Password string `json:"password"` Host string `json:"host"` Port string `json:"port"` Charset string `json:"charset"` TablePrefix string `json:"table_prefix"` DB *sql.DB `json:"-"` }
Database 数据库配置 @since 0.0.1
func (Database) DataSourceName ¶
DataSourceName 获取数据库连接字符串 @since 0.0.1 @since 0.0.10 取消 dburl 的引用
func (Database) DataSourceNameGORM ¶
DataSourceNameGORM 因为系统 SQL 和 GORM DNS 不一样 见下连接 详细原因待查 @since 0.0.1
type Static ¶
type Static struct { RelativePath string `json:"relative_path"` Root string `json:"root"` Type string `json:"type"` }
Static 静态文件目录 @since 0.0.1 @since 0.0.10 支持单个静态文件
Click to show internal directories.
Click to hide internal directories.