context.go 944 B

12345678910111213141516171819202122232425262728293031323334
  1. // ================================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // You can delete these comments if you wish manually maintain this interface file.
  4. // ================================================================================
  5. package service
  6. import (
  7. "context"
  8. "github.com/gogf/gf/v2/net/ghttp"
  9. "github.com/tiger1103/gfast/v3/internal/app/system/model"
  10. )
  11. type IContext interface {
  12. Init(r *ghttp.Request, customCtx *model.Context)
  13. Get(ctx context.Context) *model.Context
  14. SetUser(ctx context.Context, ctxUser *model.ContextUser)
  15. GetLoginUser(ctx context.Context) *model.ContextUser
  16. GetUserId(ctx context.Context) uint64
  17. }
  18. var localContext IContext
  19. func Context() IContext {
  20. if localContext == nil {
  21. panic("implement not found for interface IContext, forgot register?")
  22. }
  23. return localContext
  24. }
  25. func RegisterContext(i IContext) {
  26. localContext = i
  27. }