Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPasswordHash(password, hash string) bool
- func GenerateRandomString(length int) string
- func HashPassword(password string) (string, error)
- func SendAPIErrorResp(w io.Writer, message string, status int)
- func SendAPIOKResp(w io.Writer, message string)
- func SendAPIOKRespWithData(w io.Writer, message string, data interface{})
- func SendAPIResp(w io.Writer, data interface{})
- type ErrorViewData
- type LoginSession
- type LoginSessionManager
- func (manager *LoginSessionManager) GetBySessionID(sessionID string) (*LoginSession, error)
- func (manager *LoginSessionManager) GetByUsername(username string) (*LoginSession, error)
- func (manager *LoginSessionManager) IsUserLoggedIn(sessionID, username string) bool
- func (manager *LoginSessionManager) IsUserNotLoggedIn(sessionID, username string) bool
- func (manager *LoginSessionManager) New(username string) string
- func (manager *LoginSessionManager) Remove(username string) error
- type ViewsMaker
- type YamlConfig
Constants ¶
View Source
const ( IPAddress = "localhost" DefaultPort = "8080" )
View Source
const DBTypeInMemory = "mem"
View Source
const DBTypePostgres = "postgres"
View Source
const PostgresDev = "dev"
View Source
const PostgresProduction = "production"
Variables ¶
View Source
var EmptySignal = models.Signal{}
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func CheckPasswordHash ¶
func GenerateRandomString ¶
func HashPassword ¶
func SendAPIOKResp ¶
func SendAPIOKRespWithData ¶
func SendAPIResp ¶
Types ¶
type ErrorViewData ¶
type LoginSession ¶
type LoginSessionManager ¶
type LoginSessionManager struct {
// contains filtered or unexported fields
}
func NewLoginSessionHandler ¶
func NewLoginSessionHandler() *LoginSessionManager
func (*LoginSessionManager) GetBySessionID ¶
func (manager *LoginSessionManager) GetBySessionID(sessionID string) (*LoginSession, error)
func (*LoginSessionManager) GetByUsername ¶
func (manager *LoginSessionManager) GetByUsername(username string) (*LoginSession, error)
func (*LoginSessionManager) IsUserLoggedIn ¶
func (manager *LoginSessionManager) IsUserLoggedIn(sessionID, username string) bool
func (*LoginSessionManager) IsUserNotLoggedIn ¶
func (manager *LoginSessionManager) IsUserNotLoggedIn(sessionID, username string) bool
func (*LoginSessionManager) New ¶
func (manager *LoginSessionManager) New(username string) string
func (*LoginSessionManager) Remove ¶
func (manager *LoginSessionManager) Remove(username string) error
type ViewsMaker ¶
type ViewsMaker struct {
// contains filtered or unexported fields
}
func NewViewsMaker ¶
func NewViewsMaker(viewsDir string) (*ViewsMaker, error)
func (*ViewsMaker) RenderErrorView ¶
func (vm *ViewsMaker) RenderErrorView(w http.ResponseWriter, username string, title string, status int, message string)
func (*ViewsMaker) RenderIndex ¶
func (vm *ViewsMaker) RenderIndex(w http.ResponseWriter)
func (*ViewsMaker) RenderView ¶
func (vm *ViewsMaker) RenderView(w http.ResponseWriter, page string, viewData interface{})
type YamlConfig ¶
type YamlConfig struct { MuteRequestPathLogs bool `yaml:"mute_request_path_logs"` PingTimeout int `yaml:"db_ping_timeout"` DBType string `yaml:"dbtype"` // TODO: should have one general env variable PostgresEnv string `yaml:"postgres_env"` Graphite struct { Enabled bool Host string Port int } DBProd struct { Host string Port int Name string User string SSLMode string `yaml:"sslMode"` } `yaml:"postgres_production"` DBDev struct { Host string Port int Name string User string SSLMode string `yaml:"sslMode"` } `yaml:"postgres_dev"` }
func NewYamlConfig ¶
func NewYamlConfig(yamlContent []byte) (*YamlConfig, error)
func (*YamlConfig) GetPostgresDBName ¶
func (c *YamlConfig) GetPostgresDBName() string
func (*YamlConfig) GetPostgresDBSSLMode ¶
func (c *YamlConfig) GetPostgresDBSSLMode() string
func (*YamlConfig) GetPostgresDBUsername ¶
func (c *YamlConfig) GetPostgresDBUsername() string
func (*YamlConfig) GetPostgresHost ¶
func (c *YamlConfig) GetPostgresHost() string
func (*YamlConfig) GetPostgresPort ¶
func (c *YamlConfig) GetPostgresPort() int
Click to show internal directories.
Click to hide internal directories.