Documentation ¶
Index ¶
- func InitDB(dataSource string, migrationSource string, maxIdleConn int, ...) (*sql.DB, error)
- type API
- func (api *API) AllClassifierTypeSelectors(w http.ResponseWriter, r *http.Request)
- func (api *API) AllLegalBases(w http.ResponseWriter, r *http.Request)
- func (api *API) AllSurveys(w http.ResponseWriter, r *http.Request)
- func (api *API) Close()
- func (api *API) GetClassifierTypeSelectorByID(w http.ResponseWriter, r *http.Request)
- func (api *API) GetSurvey(w http.ResponseWriter, r *http.Request)
- func (api *API) GetSurveyByReference(w http.ResponseWriter, r *http.Request)
- func (api *API) GetSurveyByShortName(w http.ResponseWriter, r *http.Request)
- func (api *API) Info(w http.ResponseWriter, r *http.Request)
- func (api *API) PostSurveyDetails(w http.ResponseWriter, r *http.Request)
- func (api *API) PutSurveyDetails(w http.ResponseWriter, r *http.Request)
- type ClassifierTypeSelector
- type ClassifierTypeSelectorSummary
- type LegalBasis
- type RESTError
- type Survey
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct { AllSurveysStmt *sql.Stmt GetSurveyStmt *sql.Stmt GetSurveyByShortNameStmt *sql.Stmt GetSurveyByReferenceStmt *sql.Stmt GetSurveyIDStmt *sql.Stmt GetClassifierTypeSelectorStmt *sql.Stmt GetClassifierTypeSelectorByIDStmt *sql.Stmt GetSurveyRefStmt *sql.Stmt PutSurveyDetailsBySurveyRefStmt *sql.Stmt CreateSurveyStmt *sql.Stmt GetLegalBasesStmt *sql.Stmt GetLegalBasisFromLongNameStmt *sql.Stmt GetLegalBasisFromRefStmt *sql.Stmt GetSurveyByShortnameStmt *sql.Stmt Validator *validator2.Validate }
API contains all the pre-prepared sql statements
func (*API) AllClassifierTypeSelectors ¶
func (api *API) AllClassifierTypeSelectors(w http.ResponseWriter, r *http.Request)
AllClassifierTypeSelectors returns all the classifier type selectors for the survey identified by the string surveyID. The classifier type selectors are returned in ascending order.
func (*API) AllLegalBases ¶
func (api *API) AllLegalBases(w http.ResponseWriter, r *http.Request)
AllLegalBases returns details of all legal bases
func (*API) AllSurveys ¶
func (api *API) AllSurveys(w http.ResponseWriter, r *http.Request)
AllSurveys returns summaries of all known surveys. The surveys are returned in ascending short name order.
func (*API) GetClassifierTypeSelectorByID ¶
func (api *API) GetClassifierTypeSelectorByID(w http.ResponseWriter, r *http.Request)
GetClassifierTypeSelectorByID returns the details of the classifier type selector for the survey identified by the string surveyID and the classifier type selector identified by the str ing classifierTypeSelectorID.
func (*API) GetSurvey ¶
func (api *API) GetSurvey(w http.ResponseWriter, r *http.Request)
GetSurvey returns the details of the survey identified by the string surveyID.
func (*API) GetSurveyByReference ¶
func (api *API) GetSurveyByReference(w http.ResponseWriter, r *http.Request)
GetSurveyByReference returns the details of the survey identified by the string ref.
func (*API) GetSurveyByShortName ¶
func (api *API) GetSurveyByShortName(w http.ResponseWriter, r *http.Request)
GetSurveyByShortName returns the details of the survey identified by the string shortName.
func (*API) Info ¶
func (api *API) Info(w http.ResponseWriter, r *http.Request)
Info endpoint handler returns info like name, version, origin, commit, branch and built
func (*API) PostSurveyDetails ¶
func (api *API) PostSurveyDetails(w http.ResponseWriter, r *http.Request)
PostSurveyDetails endpoint handler - creates a new survey based on JSON in request
func (*API) PutSurveyDetails ¶
func (api *API) PutSurveyDetails(w http.ResponseWriter, r *http.Request)
PutSurveyDetails endpoint handler changes a survey short name using the survey reference
type ClassifierTypeSelector ¶
type ClassifierTypeSelector struct { ID string `json:"id"` Name string `json:"name"` ClassifierTypes []string `json:"classifierTypes"` }
ClassifierTypeSelector represents the detail of a classifier type selector.
type ClassifierTypeSelectorSummary ¶
ClassifierTypeSelectorSummary represents a summary of a classifier type selector.
type LegalBasis ¶
LegalBasis - the legal basis for a survey consisting of a short reference and a long name
type RESTError ¶
type RESTError struct { Code string `json:"code"` Message string `json:"message"` Timestamp string `json:"timestamp"` }
RESTError represents a client-side (HTTP 4xx) or server-side (HTTP 5xx) error. This is for compatibility with our Java microservices which expect this object.
func NewRESTError ¶
NewRESTError returns a RESTError with the Timestamp field pre-populated.
type Survey ¶
type Survey struct { ID string `json:"id"` ShortName string `json:"shortName" validate:"required,no-spaces,max=20"` LongName string `json:"longName" validate:"required,max=100"` Reference string `json:"surveyRef" validate:"required,numeric,max=20"` LegalBasis string `json:"legalBasis"` SurveyType string `json:"surveyType"` LegalBasisRef string `json:"legalBasisRef"` }
Survey represents the details of a survey.