PHP developers quickly get started using the Gorose orm for Go

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Recently infatuated with Go language, have a special affection to go.
However, as a result of the development of PHP for a long time, just start with go to do web development a bit less accustomed to, perhaps the previous laravel framework of the eloquent ORM is too good, so, led to use go to do web development of a variety of non-adaptation.
So, looking for a similar ORM use, looking all over the go ecosystem, found a lot of well-known go orm, such as: Gorm, Xorm, SQLX, and so on, found that no one is my feel, in the experience of a variety of unpleasant to, a lesson from the bitter, I have a go orm, Goros E was born so.
Gorose, is a mini go ORM, can also be said to be Golang version of the Laravel eloquent, because like this feel, began to masturbate, after a week of femdom, first edition on the line to see the effect:

Gorose Linked Database

// 开启一个链接db := gorose.Open("这是数据库配置啊配置")// 执行完毕后关闭数据库 DBdefer db.Close()

Laravel-like simple query

db.Table("userinfo").First()

The parsed SQL is: select * from userinfo limit 1
is not very familiar with the feeling, the more familiar is still behind

Multi-Conditional chain query

db.Table("userinfo").Where("id","<",10).Order("id desc").Get()

The parsed SQL is:select * from userinfo where id<10 order by id desc

Native query

db.Query("select * from userinfo")db.Query("select * from userinfo where id>?", 1)

is not PHP orm feel back again, yes, not only that, eloquent most of the usage, can be used directly here, more usage

    • Please look at Github.com/gohouse/gorose.
    • Or click Join QQ Group: 470809220 slowly tease ~ ~ ~

Powered by Fizzday (Week VIII)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.