Documentation ¶
Index ¶
- Variables
- func BytesToBase64(bytes []byte) string
- func GetAuthorization(w http.ResponseWriter, r *http.Request, id ...int) (int, error)
- func GetHttpParam(w http.ResponseWriter, ps httprouter.Params, name string) (int, error)
- func HttpValidateUsername(w http.ResponseWriter, username string) bool
- func NowFormat() string
- func SetHeaderJson(w http.ResponseWriter)
- func SetHeaderText(w http.ResponseWriter)
- func ValidateUsername(username string) error
- type Comment
- type Like
- type Photo
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCaptionTooBig = errors.New("the caption exceeds the maximun length")
View Source
var ErrCommentNotFound = errors.New("comment not found")
View Source
var ErrCommentNotValid = errors.New("the given comment doesn't match the required length")
View Source
var ErrEncodingJson = errors.New("error encoding json")
View Source
var ErrNotPhoto = errors.New("the given file is not an image")
View Source
var ErrPhotoNotFound = errors.New("photo not found")
View Source
var ErrPhotoTooBig = errors.New("the provided photo exceeds the maximum dimension")
View Source
var ErrUserDetailsNotValid = errors.New("the user's details dont match the required pattern")
View Source
var ErrUserNotFound = errors.New("user not found")
View Source
var ErrUsernameMissing = errors.New("missing required username")
View Source
var ErrUsernameNotValid = errors.New("the username doesnt match the required pattern")
View Source
var ErrUsernameTaken = errors.New("the username is already taken")
Functions ¶
func BytesToBase64 ¶
func GetAuthorization ¶
func GetHttpParam ¶
func GetHttpParam(w http.ResponseWriter, ps httprouter.Params, name string) (int, error)
func HttpValidateUsername ¶
func HttpValidateUsername(w http.ResponseWriter, username string) bool
Write the right response code based on the validity of the username
func SetHeaderJson ¶
func SetHeaderJson(w http.ResponseWriter)
func SetHeaderText ¶
func SetHeaderText(w http.ResponseWriter)
func ValidateUsername ¶
Database checks if username is between 3 and 16 characters
Types ¶
type Comment ¶
type User ¶
type User struct { UserID int `json:"id"` Username string `json:"username"` Name string `json:"name"` Surname string `json:"surname"` FollowersCount int `json:"followersCount"` FollowingCount int `json:"followingCount"` PhotoCount int `json:"photoCount"` Followed bool `json:"followed"` Banned bool `json:"banned"` }
Click to show internal directories.
Click to hide internal directories.