db.go 223 B

1234567891011
  1. package middleware
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/go-admin-team/go-admin-core/sdk"
  5. )
  6. func WithContextDb(c *gin.Context) {
  7. c.Set("db", sdk.Runtime.GetDbByKey(c.Request.Host).WithContext(c))
  8. c.Next()
  9. }