Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/doorofchoice/pagination
It's can generate any href you want, and it depends on beego/orm
go get github.com/doorOfChoice/pagination
//o: need a query seter, such as o.QueryTable("user")
//tp: the interface to get datas
//params[0], count of show href link in paginatior DEFAULT:5
//params[1], count of show data in per page DEFAULT 15
func NewPaginator(r *http.Request, o orm.QuerySeter, tp interface{}, params ...int64) *Paginator
userController.go
// If I has a model is User
type User struct{
Id int `orm:"auto;pk"`
Name string
}
func (c *UserController) GetAllUsers() {
var users []*User
o := orm.NewOrm()
//generate a paginator
paginator := pagination.NewPaginator(
c.Ctx.Request,
o.Query("user").Filter("id" > 5),
&users,
15,
15,
)
c.Data["P"] = paginator
c.Data["Users"] = users
c.TplName = "user.tpl"
}
There are some params, you can use it in template
type Paginator struct {
PageLinkPrev string
PageLinkNext string
PageLinkLast string
PageLinkFirst string
PerValue int64
MaxValue int64 //sum of data in the table
CurrentValue int64 //how many data in current page
CurrentPage int64
MaxPage int64
BasePath string
Links []Link //generated links
}
type Link struct {
Id int64 //which page
IsCurrent bool //is current page
Href string//the href
}
MIT
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.