Documentation ¶
Index ¶
- Variables
- func Any[T any](Expr bool, TrueReturn, FalseReturn T) T
- func AnyTo[T any](Expr bool, Pointer *T, Value T)
- func Cors() gin.HandlerFunc
- func Download(url string) (local string)
- func ErrorCTX(err error, c *gin.Context, code int) bool
- func ExprCTX(expr bool, c *gin.Context, code int, msg string) bool
- func FileExists(path string) bool
- func Filter[T any](s []T, fn func(T) bool) []T
- func ForEach[T any](fn func(*sql.Rows) T, cmd string, args ...any) (result []T)
- func GetPost(c *gin.Context)
- func GetRandomToken(c *gin.Context)
- func GetRequest(oid int64) func() []Replies
- func GetUserByQuery(c *gin.Context) (int64, string, string)
- func In(user *User, pm *PostMonitor) bool
- func Login(c *gin.Context)
- func MakeDir(path string)
- func Modify(c *gin.Context)
- func Register(c *gin.Context)
- func ReplaceData(text string, post *Post) string
- func RequestUser(job Job)
- func Run(addr ...string)
- func SetComments(Comments *[]*Post, post *Post)
- func SimilarText(first, second string) float64
- func ToGetUrlsByWatch(cmd func(string) string) func(string) []string
- func UpdateConfig(c *gin.Context)
- func UpdatePost(c *gin.Context)
- func Url2Local(url string) string
- func Webhook(post *Post)
- type ApiData
- type Config
- type Job
- type Post
- type PostList
- func (pl *PostList) GetPostByName(name string) *Post
- func (pl *PostList) GetPostByTime(BeginTime, EndTime int64) []Post
- func (pl *PostList) Len() int
- func (pl *PostList) Less(i, j int) bool
- func (pl *PostList) PushBottom(post Post)
- func (pl *PostList) PushComment(repostID string, post Post)
- func (pl *PostList) PushSort(post Post)
- func (pl *PostList) Swap(i, j int)
- type PostMonitor
- type Replies
- type User
- type Yml
Constants ¶
This section is empty.
Variables ¶
View Source
var GetReplies func() []Replies
返回最近回复
View Source
var GetUrlsByWatch func(watch string) (Urls []string)
根据 watch 返回 url。
View Source
var Monitors = make(map[string]PostMonitor)
View Source
var PostStmt *sql.Stmt
View Source
var RandomToken = make(map[string][2]string)
随机密钥
View Source
var UpdateTime = make(map[int64]int64)
更新博文的时间
Functions ¶
func Cors ¶
func Cors() gin.HandlerFunc
func FileExists ¶
FileExists 判断一个文件是否存在
func GetRequest ¶
func In ¶
func In(user *User, pm *PostMonitor) bool
判断用户是否已经提交
参考 https://blog.csdn.net/weixin_42282999/article/details/108542734
func ToGetUrlsByWatch ¶
获取 GetUrlsByWatch 函数
Types ¶
type Config ¶
type Job ¶ added in v0.9.7
type Job struct { Patten string `form:"patten" yaml:"patten"` Method string `form:"method" yaml:"method"` Url string `form:"url" yaml:"url"` Headers map[string]string `form:"headers" yaml:"headers"` Data map[string]string `form:"data" yaml:"data"` }
func GetJobsByUser ¶ added in v0.9.7
type Post ¶
type Post struct { // 博文相关 Mid string `form:"mid" json:"mid"` Time int64 `form:"time" json:"time"` Text string `form:"text" json:"text"` Type string `form:"type" json:"type"` Source string `form:"source" json:"source"` // 博主相关 Uid string `form:"uid" json:"uid"` Name string `form:"name" json:"name"` Face string `form:"face" json:"face"` Pendant string `form:"pendant" json:"pendant"` Description string `form:"description" json:"description"` // 粉丝关注 Follower string `form:"follower" json:"follower"` Following string `form:"following" json:"following"` // 附件 Attachment []string `form:"attachment" json:"attachment"` PicUrls []string `form:"picUrls" json:"picUrls"` Repost *Post `form:"repost" json:"repost"` Comments []*Post `json:"comments"` }
一条博文包含的信息
type PostList ¶
type PostList struct { // 列表长度 Length int // 最近博文时间 LastPostTime int64 // 博文列表 Posts []Post // 是否存在 Positions map[string]int }
func (*PostList) GetPostByTime ¶
返回给定时间之后的博文
func (*PostList) PushBottom ¶
func (*PostList) PushComment ¶ added in v0.9.7
插入评论
type PostMonitor ¶
博文检查器
func (PostMonitor) Len ¶
func (pm PostMonitor) Len() int
func (PostMonitor) Less ¶
func (pm PostMonitor) Less(i, j int) bool
func (PostMonitor) Swap ¶
func (pm PostMonitor) Swap(i, j int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.