Documentation
¶
Index ¶
- Constants
- func CreateToken(userID int) string
- func DBInit() (*sql.DB, error)
- func DeleteBucket(s *session.Session, icon string) bool
- func IsBirthday(birthday string) bool
- func IsComment(comment string) bool
- func IsContent(content string) bool
- func IsEmailAddress(emailAddress string) bool
- func IsID(ID int) bool
- func IsImageURL(imageURL []string) bool
- func IsName(name string) bool
- func IsPassword(password string) bool
- func IsTitle(title string) bool
- func UploadingToS3(s *session.Session, file multipart.File, fileHeader *multipart.FileHeader) (string, error)
- func VerifyToken(reqHead string) int
Constants ¶
const ( ContentType = "Content-Type" ApplicationJSON = "application/json;charset=utf-8" Cors = "Access-Control-Allow-Origin" ArrowHeader = "Access-Control-Allow-Headers" Credential = "Access-Control-Allow-Credentials" ArrowMethods = "Access-Control-Allow-Methods" Methods = "PUT,POST,GET,DELETE,OPTIONS" True = "true" CorsWildCard = "*" Authorization = "Authorization" )
Application form type
const ( Post = "POST" Get = "GET" Put = "PUT" Delete = "DELETE" Options = "OPTIONS" )
HTTP request method
const ( Trending = "/" Timeline = "/timeline" LoginPath = "/login" SignUpPath = "/signUp" LikePost = "/likePost" DeleteLikedPost = "/deleteLikedPost" ShowFavoritePosts = "/favoritePostsList" FavoritePost = "/favoritePost" DeleteFavoritePost = "/deleteFavorite" UserPostsList = "/userPostsList" SinglePost = "/post" NewPost = "/newPost" EditPost = "/editPost" DeletePost = "/deletePost" ShowProfile = "/showProfile" EditProfile = "/editProfile" DeleteAccount = "/deleteAccount" UploadingIcon = "/uploadIcon" ChangeIcon = "/changeIcon" UploadingImages = "/uploadingImages" DeleteImages = "/deleteImages" )
Each path
const ( SuccessCode = 0 WrongUserNamePassword = 1 InvalidToken = 2 InvalidSignUpUsername = 3 InvalidSignUpMailAddress = 4 InvalidSignUpPassword = 5 NotMatchPasswords = 6 FailedLoginCode = 7 FailedDeleteLike = 8 FailedFavoritePost = 9 FailedDeleteFavorite = 10 FailedDeletePost = 11 InvalidCreateTitle = 12 InvalidCreateContent = 13 InvalidEditTitle = 14 InvalidEditContent = 15 InvalidEditProfileUserName = 16 InvalidEditProfileBirthday = 17 InvalidEditProfileMailAddress = 18 InvalidEditProfileComment = 19 FailedDeleteAccount = 20 FailedEditProfile = 21 FailedEditPost = 22 OverSizeIcon = 23 NoIconSelected = 24 FailedRegisterIcon = 25 FailedDeleteIconFromS3 = 26 FailedUpdateIcon = 27 FailedGenerateAWSSession = 28 FailedUploadImages = 29 GetEmptyIconURL = 30 FailedDeleteIconFromDB = 31 FailedGetProfile = 32 FailedCreateNewPost = 33 InvalidDeleteImageURL = 34 FailedDeleteImages = 35 FailedDeleteImageFromDB = 36 InvalidExtension = 37 )
Error code
const LogFile = "./all-the-logs.log"
LogFile is the Log file path
Variables ¶
This section is empty.
Functions ¶
func DeleteBucket ¶
DeleteBucket delete icon from aws bucket.
func IsBirthday ¶
IsBirthday checks if a value is valid birthday.
func IsComment ¶
IsComment checks if a value si valid comment. It checks - a value is not empty. - a value's length is 1 to 140. It returns a result in boolean.
func IsContent ¶
IsContent checks if a value is valied content. It checks - a value is not empty. - a value's length is 1 to 500. It returns a result in boolean.
func IsEmailAddress ¶
IsEmailAddress checks if email address in paramter can be valid. It checks if mail address is matched to mail address pattern. It returns true or false.
func IsID ¶
IsID checks if a value is valid. It checks - a value is larger than 0. It returns a result in boolean.
func IsImageURL ¶
IsImageURL is a validation method that tests if string get from request is empty.
func IsName ¶
IsName checks if name in parameter can be usable. It checks if name length is not 0 and 1 to 20. This returns true or false.
func IsPassword ¶
IsPassword checks if password in parameter is valid. It checks ・The length is least 8 character and less than 20 character. ・At least one number is contained. ・At least one special caracter. It returns true or false.
func IsTitle ¶
IsTitle checks if a value is valied title. It checks - a value is not empty. - a value's length is 1 to 50. It returns a result in boolean.
func UploadingToS3 ¶
func UploadingToS3(s *session.Session, file multipart.File, fileHeader *multipart.FileHeader) (string, error)
UploadingToS3 saves a file to aws bucket
Types ¶
This section is empty.