You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
242 B
Go
14 lines
242 B
Go
3 years ago
|
package auth
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
func UserScope(c *gin.Context) func(db *gorm.DB) *gorm.DB {
|
||
|
return func(db *gorm.DB) *gorm.DB {
|
||
|
userId := c.GetUint("user_id")
|
||
|
return db.Where("user_id", userId)
|
||
|
}
|
||
|
}
|