Documentation ¶
Index ¶
- Variables
- func FileExists(name string) bool
- func GetAlgorithmName(id packet.PublicKeyAlgorithm) string
- func HoursFromNowString(n int) string
- func JSONResponse(w http.ResponseWriter, status int, data interface{})
- func NormalizeUsername(input string) string
- func ParseRequest(r *http.Request, data interface{}) error
- func RemoveDots(input string) string
- func StringToTime(in string) (time.Time, error)
- func TimeNowString() string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidContentType is returned by ParseRequest if it can't unmarshal it into the passed struct ErrInvalidContentType = errors.New("Invalid request content type") )
Functions ¶
func FileExists ¶
FileExists is a stupid little wrapper of os.Stat that checks whether a file exists
func GetAlgorithmName ¶
func GetAlgorithmName(id packet.PublicKeyAlgorithm) string
GetAlgorithmName returns algorithm's name depending on its ID
func HoursFromNowString ¶
HoursFromNowString returns time.Now + n hours in string format. The result is RFC3339 encoded and in UTC. This makes it possible to compare the times with a simple string comparison. Example: "2006-12-30T15:34:45Z00:00"
func JSONResponse ¶
func JSONResponse(w http.ResponseWriter, status int, data interface{})
JSONResponse writes JSON to an http.ResponseWriter with the corresponding status code
func NormalizeUsername ¶
func ParseRequest ¶
ParseRequest takes the input body from the passed request and tries to unmarshal it into data
func RemoveDots ¶
func StringToTime ¶
StringToTime returns a time.Time object from a RFC3339-encoded string.
func TimeNowString ¶
func TimeNowString() string
TimeNowString returns time.Now + UTC + Format(RFC3339). This makes the strings comparable.
Types ¶
This section is empty.