package utils import ( "errors" . "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types" ) func GetIdFromUrl(c *Context, target string) (string, error) { if !c.R.URL.Query().Has(target) { return "", errors.New("Query does not have " + target) } id := c.R.URL.Query().Get("id") if len(id) == 0 { return "", errors.New("Query is empty for " + target) } if !IsValidUUID(id) { return "", errors.New("Value of query is not a valid uuid for " + target) } return id, nil }