Documentation
¶
Index ¶
- func DisconnectClient(logger *zap.SugaredLogger, client *mongo.Client)
- func FromFormURLEncoded(i interface{}, r map[string][]string) error
- func FromFormURLEncodedRequest(i interface{}, r *http.Request) error
- func FromJSON(i interface{}, r io.Reader) error
- func GetIP(r *http.Request) string
- func RespondWithError(rw http.ResponseWriter, code int, message string) error
- func StartGracefully(logger *zap.SugaredLogger, server *http.Server, timeoutDuration time.Duration)
- func StartGrpcGracefully(logger *zap.SugaredLogger, server *grpc.Server, listener net.Listener)
- func StartMongoServer(url, databaseName string, timeout time.Duration) (*mgm.Config, *mongo.Client, *mongo.Database, error)
- func StartMongoServerWithFatal(logger *zap.SugaredLogger, url, databaseName string, timeout time.Duration) (*mgm.Config, *mongo.Client, *mongo.Database)
- func ToJSON(i interface{}, w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisconnectClient ¶
func DisconnectClient(logger *zap.SugaredLogger, client *mongo.Client)
func FromFormURLEncoded ¶
FromFormURLEncoded decodes objects form a parsed form
func FromFormURLEncodedRequest ¶
FromFormURLEncodedRequest decodes objects from a form url encoded request
func GetIP ¶
GetIP gets a requests IP address by reading off the forwarded-for header (for proxies) and falls back to use the remote address.
func RespondWithError ¶
func RespondWithError(rw http.ResponseWriter, code int, message string) error
func StartGracefully ¶
StartGracefully starts a http server on another go routine so when an interrupt signal hits, a timout is initialized and all active requests can be handled before shutting down.
func StartGrpcGracefully ¶
StartGrpcGracefully starts a grpc server on another go routine so when an interrupt signal hits, a timout is initialized and all active requests can be handled before shutting down.
func StartMongoServer ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.