Documentation ¶
Index ¶
- Constants
- func GetENV() string
- func GetPWD() string
- func GetPort() string
- func InitLogger()
- func LogDebug(items ...interface{})
- func LogError(items ...interface{})
- func LogInfo(items ...interface{})
- func LogNotice(items ...interface{})
- func LogWarning(items ...interface{})
- func RenderInternalError(ctx *http.RequestCtx, msg string)
- func RenderNotFoundError(ctx *http.RequestCtx, msg string)
- func RenderUnauthorized(ctx *http.RequestCtx, msg string)
- func RenderValidationErrors(ctx *http.RequestCtx, verrors map[string][]string)
- func SetStatus(ctx *http.RequestCtx, code int)
- func WriteError(ctx *http.RequestCtx, code int, obj interface{})
- func WriteJSON(ctx *http.RequestCtx, obj interface{})
- type Client
- type JwtClaim
- type JwtWrapper
- type Message
- type PgxLogger
- type PubSub
- func (ps *PubSub) AddClient(client Client) *PubSub
- func (ps *PubSub) GetSubscriptions(topic string, client *Client) []Subscription
- func (ps *PubSub) Publish(topic string, message []byte, excludeClient *Client)
- func (ps *PubSub) RemoveClient(client Client) *PubSub
- func (ps *PubSub) Subscribe(client *Client, topic string) *PubSub
- func (ps *PubSub) Unsubscribe(client *Client, topic string) *PubSub
- type Subscription
Constants ¶
View Source
const ( // PrefixInfo – light blue PrefixInfo = "\t" + CInfo + "INFO:" + CEnd + "\t" // PrefixNotice – purple PrefixNotice = "\t" + CNotice + "NOTICE:" + CEnd + "\t" // PrefixWarning – yellow PrefixWarning = "\t" + CWarning + "WARNING:" + CEnd + "\t" // PrefixError – red PrefixError = "\t" + CError + "ERROR:" + CEnd + "\t" // PrefixDebug – cyan PrefixDebug = "\t" + CDebug + "DEBUG:" + CEnd + "\t" // PrefixEnd – of the color PrefixEnd = "\t" + "\033[0m" // CInfo light blue CInfo = "\033[1;34m" // CNotice purple CNotice = "\033[1;35m" // CWarning yellow CWarning = "\033[1;33m" // CError red CError = "\033[1;31m" // CDebug cyan CDebug = "\033[0;36m" // CEnd of the color CEnd = "\033[0m" )
Variables ¶
This section is empty.
Functions ¶
func RenderInternalError ¶
func RenderInternalError(ctx *http.RequestCtx, msg string)
RenderInternalError ...
func RenderNotFoundError ¶
func RenderNotFoundError(ctx *http.RequestCtx, msg string)
RenderNotFoundError ...
func RenderUnauthorized ¶
func RenderUnauthorized(ctx *http.RequestCtx, msg string)
RenderUnauthorized ...
func RenderValidationErrors ¶
func RenderValidationErrors(ctx *http.RequestCtx, verrors map[string][]string)
RenderValidationErrors ...
Types ¶
type Client ¶
Client ...
func (*Client) SendJSONError ¶
SendJSONError ...
func (*Client) SendJSONStatus ¶
SendJSONStatus ...
type JwtClaim ¶
type JwtClaim struct { UserID int jwt.StandardClaims }
JwtClaim adds email as a claim to the token
type JwtWrapper ¶
JwtWrapper wraps the signing key and the issuer
func (*JwtWrapper) GenerateToken ¶
func (j *JwtWrapper) GenerateToken(userID int) (signedToken string, err error)
GenerateToken generates a jwt token
func (*JwtWrapper) ValidateToken ¶
func (j *JwtWrapper) ValidateToken(signedToken string) (claims *JwtClaim, err error)
ValidateToken validates the jwt token
type Message ¶
type Message struct { Action string `json:"action"` Topic string `json:"topic"` Message json.RawMessage `json:"message"` Filters json.RawMessage `json:"filters"` Event json.RawMessage `json:"event"` Slot json.RawMessage `json:"slot"` TimeZone *string `json:"timezone"` }
Message ...
type PubSub ¶
type PubSub struct { Clients []Client Subscriptions []Subscription }
PubSub ...
func (*PubSub) GetSubscriptions ¶
func (ps *PubSub) GetSubscriptions(topic string, client *Client) []Subscription
GetSubscriptions ...
func (*PubSub) RemoveClient ¶
RemoveClient ...
Click to show internal directories.
Click to hide internal directories.