Documentation ¶
Index ¶
- func HaveCid(Db *sqlx.DB, cid int) bool
- func IPInt(ip string) int64
- func InsertComment(Db *sqlx.DB, data Comments)
- func NextPageNum(Db *sqlx.DB, status string, limit, pageNum int) int
- func String2Bytes(s string) []byte
- func TestAffairs(Db *sqlx.DB, status string, limit, pagenum int) ([]Contents, []Contents)
- type Access
- type Comments
- type CommsWithTitleMix
- type Contents
- func Media(Db *sqlx.DB, limit, pageNum int) []Contents
- func PageArr(Db *sqlx.DB) []Contents
- func PageWithCid(Db *sqlx.DB, cid int) Contents
- func PostArr(Db *sqlx.DB, status string, limit, pageNum int) []Contents
- func PostWithCid(Db *sqlx.DB, cid int) Contents
- func TestQueryPostWithCid(Db *sqlx.DB, cid int) Contents
- type Fields
- type MediasWithTitleMix
- type PostWithBGMusicMix
- type PostsWithCoverMix
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertComment ¶
func NextPageNum ¶
给定当前页数和一页的数量,查询剩余页数
func String2Bytes ¶
String2Bytes直接转换底层指针,两者指向的相同的内存,改一个另外一个也会变。 效率是string([]byte{})的百倍以上,且转换量越大效率优势越明显。 转换之后若没做其他操作直接改变里面的字符,则程序会崩溃。 如 b:=String2bytes("xxx"); b[1]='d'; 程序将panic。
Types ¶
type Access ¶
type Access struct { ID int `db:"id"` UA string `db:"ua"` BrowserID string `db:"browser_id"` BrowserVersion string `db:"browser_version"` OSID string `db:"os_id"` OSVersion string `db:"os_version"` URL string `db:"url"` Path string `db:"path"` QueryString sql.NullString `db:"query_string"` IP int64 `db:"ip"` Entrypoint string `db:"entrypoint"` EntrypointDomain sql.NullString `db:"entrypoint_domain"` Referer string `db:"referer"` RefererDomain sql.NullString `db:"referer_domain"` Time int64 `db:"time"` ContentID sql.NullInt64 `db:"content_id"` MetaID sql.NullInt64 `db:"meta_id"` Robot int8 `db:"robot"` RobotID string `db:"robot_id"` RobotVersion string `db:"robot_version"` }
func (Access) SimplifyUserAgent ¶
SimplifyUserAgent 简化浏览器的User-Agent字符串并检测爬虫(bot)
func (Access) SubReferer ¶
func (Access) UnixFormat ¶
type Comments ¶
type Comments struct { Coid uint32 `db:"coid" form:"coid"` Cid uint32 `db:"cid" form:"cid"` OwnerId uint32 `db:"ownerId" form:"ownerId"` Parent uint32 `db:"parent" form:"parent"` Created int64 `db:"created" form:"created"` Author string `db:"author" form:"author"` Mail string `db:"mail" form:"mail"` Ip string `db:"ip" form:"ip"` Agent string `db:"agent" form:"agent"` Text string `db:"text" form:"text"` Type string `db:"type" form:"type"` Status string `db:"status" form:"status"` AuthorId uint8 `db:"authorId" form:"authorId"` Url sql.NullString `db:"url" form:"url"` }
func CommentsWithCid ¶
CommentsWithCid 根据文章cid查询该文章的评论
func (Comments) UnixFormat ¶
type CommsWithTitleMix ¶
func CommsWithTitle ¶
func CommsWithTitle(Db *sqlx.DB, status string, limit, pagenum int) []CommsWithTitleMix
CommsWithTitle 查询评论组,后台专用
type Contents ¶
type Contents struct { Cid int `db:"cid"` Title string `db:"title"` Slug string `db:"slug"` Created int64 `db:"created"` Modified int64 `db:"modified"` Text []byte `db:"text"` Order uint8 `db:"order"` AuthorId uint8 `db:"authorId"` Template sql.NullString `db:"template"` Type string `db:"type"` Status string `db:"status"` Password sql.NullString `db:"password"` AllowComment uint8 `db:"allowComment"` AllowPing uint8 `db:"allowPing"` AllowFeed uint8 `db:"allowFeed"` CommentsNum uint16 `db:"commentsNum"` Parent uint16 `db:"parent"` Views uint16 `db:"views"` Likes uint32 `db:"likes"` }
func TestQueryPostWithCid ¶
TestQueryPostWithCid 测试是否是指针变量
func (Contents) Bytes2String ¶
Bytes2String直接转换底层指针,两者指向的相同的内存,改一个另外一个也会变。 效率是string([]byte{})的百倍以上,且转换量越大效率优势越明显。
func (Contents) UnixFormat ¶
type MediasWithTitleMix ¶
func MediasWithTitle ¶
func MediasWithTitle(Db *sqlx.DB, limit, pagenum int) []MediasWithTitleMix
type PostWithBGMusicMix ¶
func PostWithBGMusic ¶
func PostWithBGMusic(Db *sqlx.DB, status string, limit, pagenum int) PostWithBGMusicMix
PostWithBGMusic 查询带封面的文章
type PostsWithCoverMix ¶
func PostsWithCover ¶
func PostsWithCover(Db *sqlx.DB, status string, limit, pagenum int) []PostsWithCoverMix
PostsWithCover 查询带封面的文章组
type User ¶
type User struct { Uid string `db:"uid"` Name string `db:"name"` Password string `db:"password"` Mail string `db:"mail"` Url string `db:"url"` ScreenName string `db:"screenName"` Created int64 `db:"created"` Activated int64 `db:"activated"` Logged int64 `db:"logged"` Group string `db:"group"` AuthCode string `db:"authCode"` }
Click to show internal directories.
Click to hide internal directories.