Skip to content

ElmCompany/echox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Set of Extensios for echo framework

GoDoc Go Report Card

GormAduit middleware

It associate current user (if exits from JWT token) with current db refernce so when you save an entity, the CreatedBy, UpdatedBy columns got populated.

// First your entity should embed audited.AuditedModel:
type Product struct {
	gorm.Model
	audited.AuditedModel
	code string
}

// defines the middleware rerferencing the *gorm.DB instance
e.Use(middlewarex.GormAudit(db))

// Then get gorm db reference in the handler method via:
db := middlewarex.GetGormDB(context)    // context is of type echo.Context
// use the db reference to save your entity instances.

HasRole middleware

// HasRole middleware, depends on registration of middleware.JWT
e.POST("/create-product", createProduct, middlewarex.HasRole("admin"))

About

Extensions for echo the golang web framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages