web

package
v0.0.0-...-071ea55 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseDetailsURI

type DatabaseDetailsURI struct {
	Database   string `json:"Database" uri:"Database" binding:"required"`
	Collection string `json:"Collection" uri:"Collection" binding:"required"`
}

DatabaseDetailsURI holds the database information passed in URI.

type Server

type Server struct {
	Router *gin.Engine
	// contains filtered or unexported fields
}

Server wraps everything related to web server we provide.

func New

func New(dbHost string, dbPort int, dbUser, dbPass string) *Server

New creates a new instance of a WebServer.

func NewCustom

func NewCustom(router *gin.Engine, mongo db.Proxy) *Server

NewCustom creates a new instance of Server.

func NewWithCustomDB

func NewWithCustomDB(mongo db.Proxy) *Server

NewWithCustomDB creates a new instance of a WebServer, with a custom DB handler.

func (*Server) Aggregate

func (w *Server) Aggregate(c *gin.Context)

Aggregate returns the result of an aggregation in MongoDB.

func (*Server) Find

func (w *Server) Find(c *gin.Context)

Find serves requests for fetching data in database.

func (*Server) Health

func (w *Server) Health(c *gin.Context)

Health return the names of available databases or err is DB is down.

func (*Server) Home

func (w *Server) Home(c *gin.Context)

Home serves requests for home (index).

func (*Server) Insert

func (w *Server) Insert(c *gin.Context)

Insert creeates a new entry in the database.

func (*Server) Run

func (w *Server) Run(address string)

Run starts the webserver on address.

func (*Server) Update

func (w *Server) Update(c *gin.Context)

Update changes values in an existing entry in the database.

type UpdateRequest

type UpdateRequest struct {
	Filter  interface{} `json:"filter"`
	Updates db.Quote    `json:"updates"`
}

UpdateRequest contains both the filter and the updates to be sent in a request.

Jump to

Keyboard shortcuts

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