Documentation ¶
Index ¶
- Variables
- func SetConfigCasbinModelPath(path string)
- func SetConfigPath(path string)
- type AuthConfig
- type BinderWithValidation
- type Captcha
- type CaptchaStore
- type CasbinConfig
- type Config
- type Database
- type DatabaseConfig
- type HttpConfig
- type HttpHandler
- type LogConfig
- type Logger
- type Redis
- func (a Redis) Check(keys ...string) (bool, error)
- func (a Redis) Close() error
- func (a Redis) Delete(keys ...string) (bool, error)
- func (a Redis) Get(key string, value interface{}) error
- func (a Redis) GetClient() *redis.Client
- func (a Redis) Set(key string, value interface{}, expiration time.Duration) error
- type RedisConfig
- type SuperAdminConfig
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Options( fx.Provide(NewHttpHandler), fx.Provide(NewConfig), fx.Provide(NewLogger), fx.Provide(NewDatabase), fx.Provide(NewRedis), fx.Provide(NewCaptcha), )
Module exports dependency
Functions ¶
func SetConfigCasbinModelPath ¶
func SetConfigCasbinModelPath(path string)
func SetConfigPath ¶
func SetConfigPath(path string)
Types ¶
type AuthConfig ¶
type BinderWithValidation ¶
type BinderWithValidation struct{}
Implement the bind method to verify the request's struct for parameter validation
func (BinderWithValidation) Bind ¶
func (BinderWithValidation) Bind(i interface{}, ctx echo.Context) error
type CaptchaStore ¶
type CaptchaStore struct {
// contains filtered or unexported fields
}
func (CaptchaStore) Set ¶
func (a CaptchaStore) Set(id string, value string)
type CasbinConfig ¶
type Config ¶
type Config struct { Name string `mapstructure:"Name"` Http *HttpConfig `mapstructure:"Http"` Log *LogConfig `mapstructure:"Log"` SuperAdmin *SuperAdminConfig `mapstructure:"SuperAdmin"` Auth *AuthConfig `mapstructure:"Auth"` Casbin *CasbinConfig `mapstructure:"Casbin"` Redis *RedisConfig `mapstructure:"Redis"` Database *DatabaseConfig `mapstructure:"Database"` }
Configuration are the available config values
type Database ¶
func NewDatabase ¶
NewDatabase creates a new database instance
type DatabaseConfig ¶
type DatabaseConfig struct { Engine string `mapstructure:"Engine"` Name string `mapstructure:"Name"` Host string `mapstructure:"Host"` Port int `mapstructure:"Port"` Username string `mapstructure:"Username"` Password string `mapstructure:"Password"` TablePrefix string `mapstructure:"TablePrefix"` Parameters string `mapstructure:"Parameters"` MaxLifetime int `mapstructure:"MaxLifetime"` MaxOpenConns int `mapstructure:"MaxOpenConns"` MaxIdleConns int `mapstructure:"MaxIdleConns"` }
func (*DatabaseConfig) DSN ¶
func (a *DatabaseConfig) DSN() string
type HttpConfig ¶
type HttpConfig struct { Host string `mapstructure:"Host" validate:"ipv4"` Port int `mapstructure:"Port" validate:"gte=1,lte=65535"` }
func (*HttpConfig) ListenAddr ¶
func (a *HttpConfig) ListenAddr() string
type HttpHandler ¶
type HttpHandler struct { Engine *echo.Echo RouterV1 *echo.Group Validate *validator.Validate }
func NewHttpHandler ¶
func NewHttpHandler(logger Logger, config Config) HttpHandler
NewHttpHandler creates a new request handler
type LogConfig ¶
type LogConfig struct { Level string `mapstructure:"Level"` Format string `mapstructure:"Format"` Directory string `mapstructure:"Directory"` Development bool `mapstructure:"Development"` }
LogLevel : debug,info,warn,error,dpanic,panic,fatal
default info
Format : json, console
default json
Directory : Log storage path
default "./"
type Logger ¶
type Logger struct { Zap *zap.SugaredLogger DesugarZap *zap.Logger }
Zap SugaredLogger by default DesugarZap performance-sensitive code
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
type RedisConfig ¶
type RedisConfig struct { Host string `mapstructure:"Host"` Port int `mapstructure:"Port"` Password string `mapstructure:"Password"` KeyPrefix string `mapstructure:"KeyPrefix"` }
func (*RedisConfig) Addr ¶
func (a *RedisConfig) Addr() string
type SuperAdminConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.