Documentation ¶
Index ¶
- Constants
- func Handler(s *Server) *echo.Echo
- type Server
- func (s *Server) CreateDatabase(c echo.Context) error
- func (s *Server) CreateDesignDoc(c echo.Context) error
- func (s *Server) CreateDocument(c echo.Context) error
- func (s *Server) DeleteDatabase(c echo.Context) error
- func (s *Server) DeleteDocument(c echo.Context) error
- func (s *Server) FindMango(c echo.Context) error
- func (s *Server) GetAllDatabases(c echo.Context) error
- func (s *Server) GetAllDocs(c echo.Context) error
- func (s *Server) GetChanges(c echo.Context) error
- func (s *Server) GetDatabase(c echo.Context) error
- func (s *Server) GetDocument(c echo.Context) error
- func (s *Server) GetView(c echo.Context) error
- func (s *Server) ListenAndServe() error
- func (s *Server) PutDocument(c echo.Context) error
- func (s *Server) Status(c echo.Context) error
Constants ¶
const EchoRequestIDKey = "req_id"
Variables ¶
This section is empty.
Functions ¶
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 ¶
CreateDatabase is the handler for PUT /:db. It creates a database (in the CouchDB meaning, not a PostgreSQL database).
func (*Server) CreateDesignDoc ¶
CreateDesignDoc is the handler for PUT /:db/_design/:ddoc. It creates a view (its design document) in the given database.
func (*Server) CreateDocument ¶
CreateDocument is the handler for POST /:db. It creates a document in the given database.
func (*Server) DeleteDatabase ¶
DeleteDatabase is the handler for DELETE /:db. It deletes a database (in the CouchDB meaning, not a PostgreSQL database).
func (*Server) DeleteDocument ¶
DeleteDocument is the handler for DELETE /:db/:docid. It marks the given document as deleted.
func (*Server) FindMango ¶
FindMango is the handler for POST /:db/_find. It finds documents using a declarative JSON querying syntax.
func (*Server) GetAllDatabases ¶
GetAllDatabases is the handler for GET /_all_dbs. It returns the list of the databases.
func (*Server) GetAllDocs ¶
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 ¶
GetChanges is the handler for GET /:db/_changes. It returns a sorted list of changes made to documents in the database.
func (*Server) GetDatabase ¶
GetDatabase is the handler for GET/HEAD /:db. It returns information about the given database (number of documents).
func (*Server) GetDocument ¶
GetDocument is the handler for GET/HEAD /:db/:docid. It returns the given document.
func (*Server) GetView ¶
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 ¶
ListenAndServe creates and setups the necessary http server and start it.
func (*Server) PutDocument ¶
PutDocument is the handler for PUT /:db/:docid. It creates a new document or a new revision of an existing document.