{"repo":"cdfmlr/crud","free":true,"listed":false,"github":"https://github.com/cdfmlr/crud","clone":"git clone https://github.com/cdfmlr/crud.git","description":"A package helps writing CRUD servers. All you need is this package and models.","language":"Go","stars":70,"topics":["api","crud","golang","low-code","restful"],"license":"MIT","category":"workflow-automation","readme_excerpt":"crud English 机翻中文 Crud is a golang package that helps writing CRUD servers. With this package, all you need is models, while all the rest is done for you automatically. crud = GORM + Gin + Logrus + Viper + automatic CRUD service Get started 0. get the package: 1. all you need are models, and register them in orm & router: These 32 lines of code make it an available RESTful API service with 13 endpoints: Let's explain it. orm crud/orm is an ORM package works as crud's DAO layer. It's a wrapper of GORM with responsibility for database connection and auto migrate. orm.ConnectDB is used to connect to a database. It's a wrapper of gorm.Open . And orm.RegisterModel is used to register your models, which calls gorm.AutoMigrate to build the tables. orm package also defines a Model interface. Crud can only automatically generate CRUD services for models that implement this interface. orm.BasicModel is a basic implementation of this interface. It's a wrapper of gorm.Model , which defines an auto-incrementing primary key and soft delete support: In most cases, you can just embed orm.BasicModel to your model. It's a good starting point. router crud/router is a package that helps you to generate CRUD services based on gin. It provides a router.NewRouter() function to create a new gin router. And the magic is router.CrudTodo , that will automatically make REST APIs to the model Todo at relative path /todos : BTW, the type parameter Todo is required. It's not inferable for the compiler. rou","default_branch":null,"files":null,"tree":[],"storefront":"/r/cdfmlr","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cdfmlr/crud/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}