Small tweaks

This commit is contained in:
Jamie Curnow 2023-07-19 11:52:47 +10:00
parent ed609f0bec
commit 824a22efad
No known key found for this signature in database
GPG Key ID: FFBB624C43388E9E
5 changed files with 6 additions and 29 deletions

View File

@ -1,10 +0,0 @@
package doc
import "embed"
// SwaggerFiles contain all the files used for swagger schema generation
//
//go:embed api.swagger.json
//go:embed components
//go:embed paths
var SwaggerFiles embed.FS

View File

@ -85,21 +85,6 @@ func getQueryVarInt(r *http.Request, varName string, required bool, defaultValue
return varInt, nil
}
/*
func getQueryVarBool(r *http.Request, varName string, required bool, defaultValue bool) (bool, error) {
queryValues := r.URL.Query()
varValue := queryValues.Get(varName)
if varValue == "" && required {
return false, eris.Errorf("%v was not supplied in the request", varName)
} else if varValue == "" {
return defaultValue, nil
}
return varValue == "true" || varValue == "1" || varValue == "on", nil
}
*/
func getURLParamInt(r *http.Request, varName string) (uint, error) {
var defaultValue uint = 0

View File

@ -2,11 +2,12 @@ package entity
import (
"fmt"
"npm/internal/logger"
"npm/internal/util"
"reflect"
"strings"
"npm/internal/logger"
"npm/internal/util"
"github.com/rotisserie/eris"
)

View File

@ -15,7 +15,7 @@ type Sort struct {
Direction string `json:"direction"`
}
// TableName overrides the table name used by gorm
// GetSort ...
func (p *PageInfo) GetSort(def Sort) []Sort {
if p.Sort == nil {
return []Sort{def}

View File

@ -3,10 +3,11 @@ package util
import (
"bytes"
"encoding/json"
"npm/internal/logger"
"regexp"
"strings"
"unicode"
"npm/internal/logger"
)
// CleanupWhitespace will trim up and remove extra lines and stuff