Documentation ¶
Index ¶
- Constants
- Variables
- func AnalyzeByAuthor(name string) int32
- func AnalyzePost(text string) (string, error)
- func DBGetCache(key string, data interface{}) error
- func DBRemoveCache(key string) error
- func DBUpdateCache(key string, data interface{}) error
- func Debug(s string)
- func DeletePost(id int64) error
- func GetCache(key string, data interface{}) error
- func HttpLogger(writer io.Writer) http.Handler
- func Info(s string)
- func IsAdmin(username string) bool
- func NewRespErr(err error, code int, msg ...string) error
- func RemoveCache(key string) error
- func RespondAlert(w http.ResponseWriter, err error)
- func RespondError(w http.ResponseWriter, err error)
- func Run(addr string)
- func UpdateCache(key string, data interface{}) error
- func UpdateCacheWithLimit(key string, data interface{}) error
- func ValidateSession(w http.ResponseWriter, r *http.Request) (string, error)
- func Warn(s string)
- type AnalyzeHow
- type AnalyzeReq
- type Credentials
- type Handler
- type PageInfo
- type Post
- type PostInfo
- type PostStatistics
- type SessionStatus
- type UserInfo
- type VoteStar
Constants ¶
View Source
const ( ByAuthor = 1 ByPostId = 2 )
View Source
const ( SessionAuthorized = 0 SessionInternalError = 2 )
View Source
const ( PermNone = 0 PermView = 1 << iota PermEdit = 1 << iota PermDelete = 1 << iota )
View Source
const Key_SQL_GetPostInfo = `SELECT post.*, ` +
`IFNULL(poststatistics.star1,0), ` +
`IFNULL(poststatistics.star2,0), ` +
`IFNULL(poststatistics.star3,0), ` +
`IFNULL(poststatistics.star4,0), ` +
`IFNULL(poststatistics.star5,0) ` +
`FROM post ` +
`LEFT JOIN poststatistics ` +
`ON post.id = poststatistics.postid ` +
`WHERE post.id = `
View Source
const Key_SQL_loadPost = `select * from post where id = `
Variables ¶
View Source
var ErrCacheTokenUnmatch = errors.New("Cache token unmatch")
View Source
var ErrCredentialFailed = errors.New("fail to validate credential")
View Source
var ErrHttpUnAuthorized = errors.New("StatusUnauthorized")
Functions ¶
func AnalyzeByAuthor ¶
func AnalyzePost ¶
func DBGetCache ¶
func DBRemoveCache ¶
func DBUpdateCache ¶
func DeletePost ¶
func RemoveCache ¶
func RespondAlert ¶
func RespondAlert(w http.ResponseWriter, err error)
func RespondError ¶
func RespondError(w http.ResponseWriter, err error)
func UpdateCache ¶
func UpdateCacheWithLimit ¶
func ValidateSession ¶
Types ¶
type AnalyzeHow ¶
type AnalyzeHow int64
type AnalyzeReq ¶
type AnalyzeReq struct { How AnalyzeHow `json:"how"` Author string `json:"author"` PostId int64 `json:"id"` }
type Credentials ¶
func (*Credentials) Validate ¶
func (creds *Credentials) Validate() (bool, error)
remaining:
add contraint: validate pwd regexp
type Handler ¶
func NewHandler ¶
func NewHandler() Handler
type Post ¶
type PostStatistics ¶
type SessionStatus ¶
type SessionStatus uint
Click to show internal directories.
Click to hide internal directories.