Documentation ¶
Index ¶
- Constants
- Variables
- func AddFriend(c *gin.Context)
- func CheckAndAcceptFriend(selfId int64, params *PutFriendParams) (int, string)
- func CheckAndAddFriend(selfId, friendId int64, note string) (int, error)
- func DeleteFriend(c *gin.Context)
- func DismissOneGroupChat(c *gin.Context)
- func EmailValidator(v *validator.Validate, topStruct reflect.Value, ...) bool
- func ForgetPassword(c *gin.Context)
- func GenderValidator(v *validator.Validate, topStruct reflect.Value, ...) bool
- func GetFriendsInfo(c *gin.Context)
- func GetGroupChatsUserJoined(c *gin.Context)
- func GetOneGroupChatInfo(c *gin.Context)
- func GetProfile(c *gin.Context)
- func GetResetPasswordEmail(c *gin.Context)
- func GetSubscriptionUserFollowed(c *gin.Context)
- func GetUsersInfoOfGroupChat(c *gin.Context)
- func HidePasswordAndCompleteAvatarAndQrCodeURL(userBasic *mysqlPb.UserBasic)
- func JWTAuthMiddleware() gin.HandlerFunc
- func ManageFriendShipBlacklist(selfId, friendId int64, isBlack bool) (int, string)
- func MobileValidator(v *validator.Validate, topStruct reflect.Value, ...) bool
- func ModifyFriendNote(selfId int64, params *PutFriendParams) (int, string)
- func NameValidator(v *validator.Validate, topStruct reflect.Value, ...) bool
- func NewOneGroupChat(c *gin.Context)
- func ParseQrCode(c *gin.Context)
- func PasswordValidator(v *validator.Validate, topStruct reflect.Value, ...) bool
- func PutAvatar(c *gin.Context)
- func PutFriend(c *gin.Context)
- func PutOneGroupChatAvatar(c *gin.Context)
- func PutOneGroupChatManager(c *gin.Context)
- func PutOneGroupChatName(c *gin.Context)
- func PutPassword(c *gin.Context)
- func PutProfile(c *gin.Context)
- func RelateActionValidator(v *validator.Validate, topStruct reflect.Value, ...) bool
- func SaveQRCodeLocal(data []byte, hashName string) error
- func SearchGroupChats(c *gin.Context)
- func SearchSubscriptions(c *gin.Context)
- func SearchUsers(c *gin.Context)
- func SignIn(c *gin.Context)
- func SignUp(c *gin.Context)
- func StartHttpServer()
- func UploadAvatarLocal(data []byte, hashName string) error
- func UploadDataToCloud(data []byte, hashName string) error
- func UserJoinOneGroupChat(c *gin.Context)
- func UserPutNoteInGroupChat(c *gin.Context)
- func UserQuitOneGroupChat(c *gin.Context)
- type AddFriendParams
- type DeleteFriendParams
- type NewGroupChatParam
- type PutFriendParams
- type SearchParam
- type SearchUsersParam
- type TempForgetPassword
- type TempPassword
- type TempProfile
- type UserSignIn
- type UserSignUp
Constants ¶
const (
JWTGetUserId = "user_id"
)
Variables ¶
var ( ErrNoJsonBody = errors.New("not have any JsonBodyParams") ERrPutProfileNoName = errors.New("`name` not exited in JsonBodyParams") ERrPutProfileNoMobile = errors.New("`mobile` not exited in JsonBodyParams") ERrPutProfileNoGender = errors.New("`gender` not exited in JsonBodyParams") )
var ( ErrCreatedSameNameGroupChat = errors.New("you created the same group chat already") ErrFindManagerFail = errors.New("find the manager fail") )
var (
ErrAddSelfAsFriend = errors.New("can't build a friendship with yourself")
)
var GlobalGinStyleLogger *gin.StyleLogger
the source code of the gin.StyleLogger is add by myself. the source code explanation: https://github.com/gin-gonic/gin/pull/2096
Functions ¶
func CheckAndAcceptFriend ¶
func CheckAndAcceptFriend(selfId int64, params *PutFriendParams) (int, string)
Handle a friend relationship request
func CheckAndAddFriend ¶
Check if duplicate add the user as friend or self is in black list of target user
func DismissOneGroupChat ¶
todo: update the 'is_delete' to false of the group chat
func EmailValidator ¶
func ForgetPassword ¶
ForgetPassword HTTP API function the auth-token is from the `reset password email`
func GenderValidator ¶
func GetFriendsInfo ¶
Get All the user's friends information HTTP API function
func GetGroupChatsUserJoined ¶
The all the group chat information which the user joined
func GetResetPasswordEmail ¶
GetResetPasswordEmail HTTP API function Send a email which content with the `Auth-Token` to the user's email box for reset password.
func GetUsersInfoOfGroupChat ¶
Get the information of users whom joined the group chat
func HidePasswordAndCompleteAvatarAndQrCodeURL ¶
Hide password and complete the URL of avatar and qr code
func JWTAuthMiddleware ¶
func JWTAuthMiddleware() gin.HandlerFunc
JWTAuthMiddleware, check the jwt token string from request.
func ManageFriendShipBlacklist ¶
Manage the friend blacklist
func MobileValidator ¶
func ModifyFriendNote ¶
func ModifyFriendNote(selfId int64, params *PutFriendParams) (int, string)
// Modify note on my friends
func NameValidator ¶
func PasswordValidator ¶
func PutOneGroupChatManager ¶
todo: change the manager of the group chat to other user.
func RelateActionValidator ¶
func SaveQRCodeLocal ¶
save QRCode file to local
func SearchGroupChats ¶
Search group chat information from ElasticSearch
func SearchUsers ¶
Search user HTTP API function. search data from ElasticSearch
func SignUp ¶
SignUp(Register) HTTP API function. Saving the user's basic information which the user input and set the default value for some value like gender, and create the qr code image for this user.
func StartHttpServer ¶
func StartHttpServer()
func UploadAvatarLocal ¶
Save avatar file to local dir
func UploadDataToCloud ¶
todo upload the data to cloud with a hashName
Types ¶
type AddFriendParams ¶
type DeleteFriendParams ¶
type DeleteFriendParams struct {
FriendId int64 `json:"dst_id" binding:"required"`
}
type NewGroupChatParam ¶
type NewGroupChatParam struct {
Name string `json:"name" binding:"nameValidator"`
}
type PutFriendParams ¶
type SearchParam ¶
type SearchUsersParam ¶
type TempForgetPassword ¶
type TempPassword ¶
type TempProfile ¶
type UserSignIn ¶
type UserSignUp ¶
type UserSignUp struct { Name string `json:"name" binding:"nameValidator"` Email string `json:"email" binding:"emailValidator"` Password string `json:"password" binding:"passwordValidator"` ConfirmPassword string `json:"confirm_password" binding:"required,eqfield=Password"` }
Sign Up data struct , all field required. Verify data by the validators of gin binding.