gobeego

Beego ORM with MySQL


I am new to Beego as well as Go. I read its documentation but it puts every ORM operation in the main package instead of model package. I can't understand how to organize the code. I am really very confused.


Solution

  • You can feel free to follow steps as below, and try to build your first database program.

    1. Build [Models] According to the table structure of your database.
    2. Initialize the ORM
    3. New an ORM instance
    4. Operate CRUD as your want

    Link:
    Guidance for Beego/orm configuration
    https://beego.me/docs/mvc/model/orm.md

    Guidance for operating CRUD on Beego/orm
    https://beego.me/docs/mvc/model/object.md