Documentation
¶
Index ¶
- Variables
- func AddBoards(w http.ResponseWriter, r *http.Request)
- func AddPost(w http.ResponseWriter, r *http.Request)
- func AddResponse(w http.ResponseWriter, r *http.Request)
- func CheckEmail(w http.ResponseWriter, r *http.Request)
- func CheckUsername(w http.ResponseWriter, r *http.Request)
- func GetBoards(w http.ResponseWriter, r *http.Request)
- func GetMesList(w http.ResponseWriter, r *http.Request)
- func GetMessage(w http.ResponseWriter, r *http.Request)
- func GetMyUid(w http.ResponseWriter, r *http.Request)
- func GetPosts(w http.ResponseWriter, r *http.Request)
- func GetResponse(w http.ResponseWriter, r *http.Request)
- func GetUserDetailInfo(w http.ResponseWriter, r *http.Request)
- func GetUserInfo(w http.ResponseWriter, r *http.Request)
- func IsLoggedIn(w http.ResponseWriter, r *http.Request)
- func Login(w http.ResponseWriter, r *http.Request)
- func Logout(w http.ResponseWriter, r *http.Request)
- func SendMessage(w http.ResponseWriter, r *http.Request)
- func Sinup(w http.ResponseWriter, r *http.Request)
- type JsonAddBoards
- type JsonAddMessage
- type JsonAddPost
- type JsonAddResponse
- type JsonCheckEmail
- type JsonCheckUsername
- type JsonGetMessage
- type JsonGetPosts
- type JsonGetResponse
- type JsonGetUserInfo
- type JsonLogin
- type JsonSignup
Constants ¶
This section is empty.
Variables ¶
var Store *sessions.CookieStore
Gorilla session initiate
Functions ¶
func AddResponse ¶
func AddResponse(w http.ResponseWriter, r *http.Request)
func CheckEmail ¶
func CheckEmail(w http.ResponseWriter, r *http.Request)
func CheckUsername ¶
func CheckUsername(w http.ResponseWriter, r *http.Request)
func GetBoards ¶
func GetBoards(w http.ResponseWriter, r *http.Request)
getBoards is a function that handles get boards
return {"board":[{"name":"科技","path":"tech"},{"name":"体育","path":"pe"},{"name":"教育","path":"edu"}]}
func GetMesList ¶
func GetMesList(w http.ResponseWriter, r *http.Request)
func GetMessage ¶
func GetMessage(w http.ResponseWriter, r *http.Request)
func GetResponse ¶
func GetResponse(w http.ResponseWriter, r *http.Request)
func GetUserDetailInfo ¶
func GetUserDetailInfo(w http.ResponseWriter, r *http.Request)
{
"uid" : 1
}
func GetUserInfo ¶
func GetUserInfo(w http.ResponseWriter, r *http.Request)
func IsLoggedIn ¶
func IsLoggedIn(w http.ResponseWriter, r *http.Request)
true : has logged in false : not logged in
func SendMessage ¶
func SendMessage(w http.ResponseWriter, r *http.Request)
Types ¶
type JsonAddBoards ¶
{
"name" : "体育",
"path" : "pe"
}
! ---- Admin required ---- ! ########## must be modified when deploy
type JsonAddMessage ¶
SnedMessage is a function that provides private message service
{
"sendee" : 2,
"content" : "Hi Bob, I am fascinated by your face!"
}
Haobo : Auto generated from https://mholt.github.io/json-to-go/
type JsonAddPost ¶
{
"path" : "pe",
"content" : "我今天刷题了,求夸"
}
type JsonAddResponse ¶
type JsonCheckEmail ¶
type JsonCheckEmail struct {
Email string `json:"email"`
}
CheckEmail is a function that handles
{
"email" : "example@example.com"
}
Haobo : Auto generated from https://mholt.github.io/json-to-go/
type JsonCheckUsername ¶
type JsonCheckUsername struct {
Username string `json:"username"`
}
CheckUsername is a function that handles
{
"username" : "Bob"
}
Haobo : Auto generated from https://mholt.github.io/json-to-go/
type JsonGetMessage ¶
type JsonGetMessage struct {
Sendee int `json:"sendee"`
}
type JsonGetPosts ¶
type JsonGetPosts struct {
Path string `json:"path"`
}
getPosts is a function that handles get posts requests
{
"path": "index"
}
return : {"posts":[{"uid":1,"createtime":"2019-03-02 20:29:57","content":"是不是太差劲了"},{"uid":2,"createtime":"2019-04-30 20:29:57","content":"差评"}]}
type JsonGetResponse ¶
type JsonGetResponse struct {
Pid int `json:"pid"`
}
getResponse is a function that handles get responses
{
"pid": 1
}
return :
{
"uid": 1,
"username": "alice",
"createtime": "2006-01-02 15:04:05",
"content": "我在马路边捡到一分钱",
"response": [
{
"uid": 2,
"username": "bob",
"createtime": "2006-01-02 15:04:05",
"content": "我并不认为你捡过钱"
},
{
"uid": 1,
"username": "alice",
"createtime": "2006-01-02 15:04:05",
"content": "我确确实实捡了钱"
},
{
"uid": 1,
"username": "alice",
"createtime": "2006-01-02 15:04:05",
"content": "我就是捡了钱"
}
]
}
or
return :
{
"uid": 1,
"username": "alice",
"createtime": "2006-01-02 15:04:05",
"content": "马上交到警察叔叔手里面",
"response": null
}
type JsonGetUserInfo ¶
type JsonGetUserInfo struct {
UID int `json:"uid"`
}
type JsonLogin ¶
Login is a function that handles users' login requests.
{
"username" : "Bob",
"password" : "password"
}
Haobo : Auto generated from https://mholt.github.io/json-to-go/
type JsonSignup ¶
type JsonSignup struct {
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"password"`
Gender int `json:"gender"`
Birthday string `json:"birthday"`
}
Signup is a function that handles users' register requests.
{
"email" : "example@example.com",
"username" : "Bob",
"password" : "password",
"gender" : 0,
"birthday" : "2001-01-01"
}
Haobo : Auto generated from https://mholt.github.io/json-to-go/