web

package
v0.0.0-...-598abe1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const EchoRequestIDKey = "req_id"

Variables

This section is empty.

Functions

func Handler

func Handler(s *Server) *echo.Echo

Handler returns the echo handler for HTTP requests.

Types

type Server

type Server struct {
	Host     string
	Port     int
	CertFile string
	KeyFile  string

	Logger *slog.Logger
	PG     *pgxpool.Pool
}

Server is a struct used to run a web server

func (*Server) CreateDatabase

func (s *Server) CreateDatabase(c echo.Context) error

CreateDatabase is the handler for PUT /:db. It creates a database (in the CouchDB meaning, not a PostgreSQL database).

func (*Server) CreateDesignDoc

func (s *Server) CreateDesignDoc(c echo.Context) error

CreateDesignDoc is the handler for PUT /:db/_design/:ddoc. It creates a view (its design document) in the given database.

func (*Server) CreateDocument

func (s *Server) CreateDocument(c echo.Context) error

CreateDocument is the handler for POST /:db. It creates a document in the given database.

func (*Server) DeleteDatabase

func (s *Server) DeleteDatabase(c echo.Context) error

DeleteDatabase is the handler for DELETE /:db. It deletes a database (in the CouchDB meaning, not a PostgreSQL database).

func (*Server) DeleteDocument

func (s *Server) DeleteDocument(c echo.Context) error

DeleteDocument is the handler for DELETE /:db/:docid. It marks the given document as deleted.

func (*Server) FindMango

func (s *Server) FindMango(c echo.Context) error

FindMango is the handler for POST /:db/_find. It finds documents using a declarative JSON querying syntax.

func (*Server) GetAllDatabases

func (s *Server) GetAllDatabases(c echo.Context) error

GetAllDatabases is the handler for GET /_all_dbs. It returns the list of the databases.

func (*Server) GetAllDocs

func (s *Server) GetAllDocs(c echo.Context) error

GetAllDocs is the handler for GET /:db/_all_docs. It returns all of the documents in the database (ie normal docs and design docs, but not local docs).

func (*Server) GetChanges

func (s *Server) GetChanges(c echo.Context) error

GetChanges is the handler for GET /:db/_changes. It returns a sorted list of changes made to documents in the database.

func (*Server) GetDatabase

func (s *Server) GetDatabase(c echo.Context) error

GetDatabase is the handler for GET/HEAD /:db. It returns information about the given database (number of documents).

func (*Server) GetDocument

func (s *Server) GetDocument(c echo.Context) error

GetDocument is the handler for GET/HEAD /:db/:docid. It returns the given document.

func (*Server) GetView

func (s *Server) GetView(c echo.Context) error

GetView is the handler for GET /:db/_design/:ddoc/_view/:view. It executes the specified view function from the specified design document.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe creates and setups the necessary http server and start it.

func (*Server) PutDocument

func (s *Server) PutDocument(c echo.Context) error

PutDocument is the handler for PUT /:db/:docid. It creates a new document or a new revision of an existing document.

func (*Server) Status

func (s *Server) Status(c echo.Context) error

Status responds with the status of the service: - 200 if everything if OK - 502 if PostgreSQL is not available

Jump to

Keyboard shortcuts

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