Versions in this module Expand all Collapse all v1 v1.3.0 Dec 17, 2025 Changes in this version + const QueryTimeout + var ErrExerciseNotFound = errors.New("exercise does not exist") + var ErrForeignKeyViolation = errors.New("referenced record does not exist") + var ErrInvalidChoice = errors.New("invalid choice: must be one of the allowed values") + var ErrInvalidDate = errors.New("invalid date: ensure the format is YYYY-MM-DD and values are realistic") + var ErrInvalidDateRange = errors.New("invalid date range") + var ErrInvalidDevice = errors.New("invalid device type. Allowed values: garmin, oura, polar, suunto") + var ErrInvalidExerciseData = errors.New("exercise data contains invalid exercise id") + var ErrInvalidIDNumeric = errors.New("id must be numeric") + var ErrInvalidLimit = errors.New("invalid limit: must be in the documented range") + var ErrInvalidOffset = errors.New("invalid offset: must be a non-negative integer") + var ErrInvalidParameter = errors.New("invalid parameter provided") + var ErrInvalidSectorCode = errors.New("invalid sector code. Allowed values: JP, NK, CC") + var ErrInvalidSource = errors.New("invalid source. Please use one of the allowed devices") + var ErrInvalidSportID = errors.New("invalid sport_id format") + var ErrInvalidTimeStamp = errors.New(...) + var ErrInvalidUUID = errors.New("invalid UUID") + var ErrInvalidValue = errors.New("invalid value provided") + var ErrInvalidnumericValue = errors.New("value must be numeric") + var ErrMaxLimitExceeded = errors.New("maximum value exceeded: please use a smaller value") + var ErrMinLimitExceeded = errors.New("minimum value not met: please use a larger value") + var ErrMissingCreatedAt = errors.New("created_at is required") + var ErrMissingData = errors.New("data is required") + var ErrMissingDate = errors.New("date is required") + var ErrMissingDuration = errors.New("duration is required") + var ErrMissingGeneral = errors.New("this field is required") + var ErrMissingHours = errors.New("hours is required") + var ErrMissingID = errors.New("id is required") + var ErrMissingMeasurementGroupID = errors.New("measurement_group_id is required") + var ErrMissingName = errors.New("name is required") + var ErrMissingNameType = errors.New("name_type is required") + var ErrMissingNationalID = errors.New("national_id is required") + var ErrMissingOuraID = errors.New("oura-id is required") + var ErrMissingPolarID = errors.New("polar-id is required") + var ErrMissingQuestionID = errors.New("question_id is required") + var ErrMissingQuestionType = errors.New("question_type is required") + var ErrMissingQuestionnaireInstanceID = errors.New("questionnaire_instance_id is required") + var ErrMissingQuestionnaireKey = errors.New("questionnaire_key is required") + var ErrMissingRaceReport = errors.New("race_report is required") + var ErrMissingSector = errors.New("sector is required") + var ErrMissingSessionID = errors.New("session_id is required") + var ErrMissingSeverity = errors.New("severity is required") + var ErrMissingSource = errors.New("source is required") + var ErrMissingSportID = errors.New("sport_id is required") + var ErrMissingSporttiID = errors.New("sportti_id is required") + var ErrMissingStartTime = errors.New("start_time is required") + var ErrMissingSymptom = errors.New("symptom is required") + var ErrMissingTimestamp = errors.New("timestamp is required") + var ErrMissingToken = errors.New("token is required") + var ErrMissingType = errors.New("type is required") + var ErrMissingTypeID = errors.New("type_id is required") + var ErrMissingTypeResultType = errors.New("type_result_type is required") + var ErrMissingUpdatedAt = errors.New("updated_at is required") + var ErrMissingUserID = errors.New("user_id is required") + var ErrMissingUsername = errors.New("username is required") + var ErrMissingValue = errors.New("value is required") + var ErrQueryTimeOut = errors.New("database query timed out") + var ErrRequestBodyTooLarge = errors.New("request body is too large") + var ErrUserNotFound = errors.New("user does not exist. Please create the user first") + func BadRequestResponse(w http.ResponseWriter, r *http.Request, err error) + func BoolPtrOrNil(b sql.NullBool) *bool + func ConflictResponse(w http.ResponseWriter, r *http.Request, err error) + func DerefInt32(i *int32) int32 + func DerefString(s *string) string + func Float64PtrOrNil(f sql.NullFloat64) *float64 + func ForbiddenResponse(w http.ResponseWriter, r *http.Request, err error) + func FormatDatePtr(t sql.NullTime) *string + func FormatTimestampPtr(t sql.NullTime) *string + func FormatValidationErrors(err error) map[string]string + func GetValidator() *validator.Validate + func HandleDatabaseError(w http.ResponseWriter, r *http.Request, err error) + func Int16AsInt32PtrOrNil(i sql.NullInt16) *int32 + func Int32PtrOrNil(i sql.NullInt32) *int32 + func Int64PtrOrNil(i sql.NullInt64) *int64 + func InternalServerError(w http.ResponseWriter, r *http.Request, err error) + func NilIfEmpty(s *string) *string + func NotFoundResponse(w http.ResponseWriter, r *http.Request, err error) + func NullBoolPtr(b *bool) sql.NullBool + func NullFloat64Ptr(f *float64) sql.NullFloat64 + func NullInt16FromInt32Ptr(v *int32) sql.NullInt16 + func NullInt32(v int32) sql.NullInt32 + func NullInt32Ptr(i *int32) sql.NullInt32 + func NullInt64Ptr(v *int64) sql.NullInt64 + func NullNumericFromFloat64Ptr(f *float64) sql.NullString + func NullNumericToFloatPtr(ns sql.NullString) *float64 + func NullString(s string) sql.NullString + func NullStringPtr(s *string) sql.NullString + func NullTimeIfEmpty(t *time.Time) sql.NullTime + func NullTimePtr(t *time.Time) sql.NullTime + func ParseDate(dateStr string) (time.Time, error) + func ParseDatePtr(dateStr *string) (*time.Time, error) + func ParseNonNegativeInt32(s string) (int32, error) + func ParsePositiveInt32(s string) (int32, error) + func ParsePositiveInt64(s string) (int64, error) + func ParseRFC3339MinuteOrSecond(s string) (time.Time, error) + func ParseRawJSON(s *string) pqtype.NullRawMessage + func ParseRequiredJSON(s string) json.RawMessage + func ParseSporttiID(s string) (string, error) + func ParseTimestamp(value string) (time.Time, error) + func ParseTimestampPtr(value *string) (*time.Time, error) + func ParseTimestampPtrFlexible(value *string) (*time.Time, error) + func ParseUUID(id string) (uuid.UUID, error) + func ParseUUIDPtr(s *string) (uuid.NullUUID, error) + func RateLimitExceededResponse(w http.ResponseWriter, r *http.Request, retryAfter string) + func RawMessagePtrOrNil(rm pqtype.NullRawMessage) *string + func RawMessageToString(rm json.RawMessage) string + func ReadJSON(w http.ResponseWriter, r *http.Request, data any) error + func ServiceUnavailableDBResponse(w http.ResponseWriter, r *http.Request, dbName string) + func StringPtrOrNil(s sql.NullString) *string + func TimePtrOrNil(t sql.NullTime) *time.Time + func UUIDPtrToStringPtr(u uuid.NullUUID) *string + func UnauthorizedBasicErrorResponse(w http.ResponseWriter, r *http.Request, err error) + func UnauthorizedResponse(w http.ResponseWriter, r *http.Request, err error) + func UnprocessableEntityResponse(w http.ResponseWriter, r *http.Request, err error) + func ValidateParams(r *http.Request, allowedParams []string) error + func WriteJSON(w http.ResponseWriter, status int, data any) error + func WriteJSONError(w http.ResponseWriter, statusCode int, message interface{}) + type InvalidFieldTypeError struct + ActualType string + ExpectedType string + Field string + func (e *InvalidFieldTypeError) Error() string