controllers

package
v0.0.0-...-4a7ee20 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2020 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package controllers provides controller functions for interacting with the dynosurveys backend databases.

Index

Constants

This section is empty.

Variables

View Source
var Ctx = tmp

Ctx represents the MongoDB context

MDB represents the MongoDB client

PDB represents the PostgreSQL DB Client

Functions

func CreateForm

func CreateForm(w http.ResponseWriter, r *http.Request)

CreateForm creates a new form in the database

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser creates a new user in the database

func FetchFormResponses

func FetchFormResponses(w http.ResponseWriter, r *http.Request)

FetchFormResponses retrieves the responses of a form from the MongoDB database.

func FindOne

func FindOne(email, password string) map[string]interface{}

FindOne searches the user database to check whether a user exists or not.

func ListForms

func ListForms(w http.ResponseWriter, r *http.Request)

ListForms retrieves a list of forms from the forms database that match a particular user_id

func Login

func Login(w http.ResponseWriter, r *http.Request)

Login attempts to log in a user and writes the response

func RecordFormResponse

func RecordFormResponse(w http.ResponseWriter, r *http.Request)

RecordFormResponse stores the response of a form into the MongoDB database.

Types

type ErrorResponse

type ErrorResponse struct {
	Err string
}

ErrorResponse structure

Jump to

Keyboard shortcuts

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