Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gopher1980/gormcrud

This is the module for create CRUD in GORM (goland)
https://github.com/gopher1980/gormcrud

crud crud-api crud-generator go gorm gorm-sample module

Last synced: 15 days ago
JSON representation

This is the module for create CRUD in GORM (goland)

Awesome Lists containing this project

README

        

# Gormcrud

Motivation for this project is to provide the a Golang module for it can drive all CRUD api of your GORM entities.

Example (gorilla/mux):

```golang
r := mux.NewRouter()
gormcrud.MapMux(r, db).
NewMap("/api/v1/author", Author{}, []Author{}).Full().
NewMap("/api/v1/category", Category{}, []Category{}).Full().
NewMap("/api/v1/tag", Tag{}, []Tag{}).Full().
NewMap("/api/v1/note", Note{}, []Note{}).Full()
http.Handle("/", r)
log.Fatal(http.ListenAndServe(addr, nil))
```
full example mux https://github.com/gopher1980/gormcrud/blob/master/mux_example/main.go

Example (Gin Web Framework):

```golang
r := gin.Default()
gormcrud.MapGin(r, db).
NewMap("/api/v1/author", Author{}, []Author{}).Full().
NewMap("/api/v1/category", Category{}, []Category{}).Full().
NewMap("/api/v1/tag", Tag{}, []Tag{}).Full().
NewMap("/api/v1/note", Note{}, []Note{}).Full()

r.Run(addr)
```

full example gin https://github.com/gopher1980/gormcrud/blob/master/gin_example/main.go