Beego ORM Sample project for database connection using MySQL driver and performing basic CRUD operations
Features:
- easy for usage, simple CRUD operation
- auto join with relation table
- Raw SQL query / mapper without orm model
- Secure and multiple driver connection (like MySQL, postgres, etc)
To Run project, follow these steps:
- Create new database, and configure .env variables
- Install Go lang if not installed then Get all project dependencies by running the following command in terminal:
go mod tidy
- Check main.go file for basic details
- Run the code by command in terminal:
go run main.go
- Check logs in terminal.
- Run the select query in user table to check results
For more implementation details check this out:
https://pkg.go.dev/github.com/beego/beego/v2/client/orm#section-readme
- main.go - main program file
- Model - database models and queries
- db.sql - Database setup
- .env - all environment variables
- go.mod - dependencies
NOTE - Project is not completely on MVC framework. Idea is to only integrate Beego ORM and perform CRUD operations. You can create your project with handle and controller, then use Postman for API interactions