You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GF(GoFrame) is a modular, full-featured and production-ready application development framework of golang. Providing a series of core components and dozens of practical modules, such as: memcache, configure, validator, logging, array/queue/set/map containers, timer/timing tasks, file/memory lock, object pool, database ORM, etc. Supporting web server integrated with router, cookie, session, logger, template, https, hooks, rewrites and many more features.
// SELECT * FROM user WHERE uid>1 LIMIT 0,10r, err:=db.Table("user").Where("uid > ?", 1).Limit(0, 10).Select()
// SELECT uid,name FROM user WHERE uid>1 LIMIT 0,10r, err:=db.Table("user").Fileds("uid,name").Where("uid > ?", 1).Limit(0, 10).Select()
// SELECT * FROM user WHERE uid=1r, err:=db.Table("user").Where("u.uid=1",).One()
r, err:=db.Table("user").Where("u.uid", 1).One()
r, err:=db.Table("user").Where("u.uid=?", 1).One()
// SELECT * FROM user WHERE (uid=1) AND (name='john')r, err:=db.Table("user").Where("uid", 1).Where("name", "john").One()
r, err:=db.Table("user").Where("uid=?", 1).And("name=?", "john").One()
// SELECT * FROM user WHERE (uid=1) OR (name='john')r, err:=db.Table("user").Where("uid=?", 1).Or("name=?", "john").One()
Where + map
// SELECT * FROM user WHERE uid=1 AND name='john'r, err:=db.Table("user").Where(g.Map{"uid" : 1, "name" : "john"}).One()
// SELECT * FROM user WHERE uid=1 AND age>18r, err:=db.Table("user").Where(g.Map{"uid" : 1, "age>" : 18}).One()
Where + struct/*struct
typeUserstruct {
Idint`json:"uid"`UserNamestring`gconv:"name"`
}
// SELECT * FROM user WHERE uid =1 AND name='john'r, err:=db.Table("user").Where(User{ Id : 1, UserName : "john"}).One()
// SELECT * FROM user WHERE uid =1r, err:=db.Table("user").Where(&User{ Id : 1}).One()
3. Update & Delete
// UPDATE user SET name='john guo' WHERE name='john'r, err:=db.Table("user").Data(gdb.Map{"name" : "john guo"}).Where("name=?", "john").Update()
r, err:=db.Table("user").Data("name='john guo'").Where("name=?", "john").Update()
// UPDATE user SET status=1 ORDER BY login_time asc LIMIT 10r, err:=db.Table("user").Data("status", 1).OrderBy("login_time asc").Limit(10).Update// DELETE FROM user WHERE uid=10r, err:=db.Table("user").Where("uid=?", 10).Delete()
// DELETE FROM user ORDER BY login_time asc LIMIT 10r, err:=db.Table("user").OrderBy("login_time asc").Limit(10).Delete()
GF is licensed under the MIT License, 100% free and open-source, forever.
Donators
We currently accept donation by Alipay/WechatPay, please note your github/gitee account in your payment bill. If you like GF, why not buy developer a cup of coffee?
Thanks
About
GoFrame is a modular, powerful, high-performance and production-ready application development framework of golang.