Documentation ¶
Index ¶
- Constants
- func CreateCommentForPostIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func CreatePostHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func CreateUserHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func GetPostByPostIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func GetPostsByUserIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func GetUserByUserIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func GetUsersHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func GoogleSearchHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, req *http.Request) (int, error)
- func PostSigninHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func PubTaskHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func ReqRepTaskHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func ZMQHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- func ZMQWithTimeoutHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
- type ApiError
- type ApiErrorCode
- type ApiHandler
- type ApiToken
- type Result
- type Results
Constants ¶
View Source
const ( ApiErrorNotAuth ApiErrorCode = 10101 ApiErrorAuthPwdError = 10102 ApiErrorAuthIdentifieNotFound = 10103 //name or email ApiErrorParamNeedId = 10201 ApiErrorParamIdNotFound = 10202 ApiErrorParamIdFmtErr = 10203 ApiErrorParamErr = 10203 ApiErrorTokenSignErr = 10301 ApiErrorTokenParseErr = 10302 ApiErrorTokenNotFound = 10303 ApiErrorGoogleSearchQueryWordNotFound = 10401 ApiErrorGoogleSearchErr = 10402 ApiErrorZmqMsgNotFound = 10501 ApiErrorZmqCanNotCreateSocket = 10502 ApiErrorZmqRequestTimeout = 10503 ApiErrorZmqErr = 10504 ApiErrorTaskQueueRequestTimeout = 10601 ApiErrorUnknow = 19901 )
error code define _ __ __
View Source
const ( REQUEST_TIMEOUT = 2000 * time.Millisecond // msecs, (> 1000!) REQUEST_RETRIES = 3 // Before we abandon SERVER_ENDPOINT = "inproc://zmq/msg/queue" )
Variables ¶
This section is empty.
Functions ¶
func CreateCommentForPostIdHandler ¶
func CreateCommentForPostIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func CreatePostHandler ¶
func CreatePostHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func CreateUserHandler ¶
func CreateUserHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func GetPostByPostIdHandler ¶
func GetPostByPostIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func GetPostsByUserIdHandler ¶
func GetPostsByUserIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func GetUserByUserIdHandler ¶
func GetUserByUserIdHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func GetUsersHandler ¶
func GetUsersHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func GoogleSearchHandler ¶
func GoogleSearchHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, req *http.Request) (int, error)
func PostSigninHandler ¶
func PostSigninHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func PubTaskHandler ¶
func PubTaskHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func ReqRepTaskHandler ¶
func ReqRepTaskHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
func ZMQHandler ¶
func ZMQHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
https://github.com/pebbe/zmq4/blob/master/examples/hwclient.go
func ZMQWithTimeoutHandler ¶
func ZMQWithTimeoutHandler(appCtx *appcontext.AppContext, w http.ResponseWriter, r *http.Request) (int, error)
Types ¶
type ApiError ¶
type ApiError struct { Code ApiErrorCode `json: "code"` Err error `json: "err"` }
type ApiErrorCode ¶
type ApiErrorCode int
type ApiHandler ¶
type ApiHandler struct { AppCtx *appcontext.AppContext Handler func(*appcontext.AppContext, http.ResponseWriter, *http.Request) (int, error) }
func (ApiHandler) ServeHTTP ¶
func (ah ApiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Results ¶
type Results []Result
////////////////// Do Google searches using the Google Web Search API. See https://developers.google.com/web-search/docs/ ////////////////// Results is an ordered list of search results.
Click to show internal directories.
Click to hide internal directories.