Skip to content

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

License

Notifications You must be signed in to change notification settings

gopher1980/gormcrud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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):

	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):

        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