utils

package
v0.0.0-...-34fb709 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisconnectClient

func DisconnectClient(logger *zap.SugaredLogger, client *mongo.Client)

func FromFormURLEncoded

func FromFormURLEncoded(i interface{}, r map[string][]string) error

FromFormURLEncoded decodes objects form a parsed form

func FromFormURLEncodedRequest

func FromFormURLEncodedRequest(i interface{}, r *http.Request) error

FromFormURLEncodedRequest decodes objects from a form url encoded request

func FromJSON

func FromJSON(i interface{}, r io.Reader) error

FromJSON decodes objects from an io.Reader

func StartGracefully

func StartGracefully(logger *zap.SugaredLogger, server *http.Server, timeoutDuration time.Duration)

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 StartMongoServer

func StartMongoServer(url, databaseName string, timeout time.Duration) (*mgm.Config, *mongo.Client, *mongo.Database, error)

func StartMongoServerWithFatal

func StartMongoServerWithFatal(logger *zap.SugaredLogger, url, databaseName string, timeout time.Duration) (*mgm.Config, *mongo.Client, *mongo.Database)

func ToJSON

func ToJSON(i interface{}, w io.Writer) error

ToJSON encodes objects and writes them using the specified io.Writer

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL