1
0

service.go 453 B

123456789101112131415161718192021222324252627
  1. package service
  2. import (
  3. "fmt"
  4. "gogs.baozhida.cn/zoie/OAuth-core/logger"
  5. "gogs.baozhida.cn/zoie/OAuth-core/storage"
  6. "gorm.io/gorm"
  7. )
  8. type Service struct {
  9. Orm *gorm.DB
  10. Msg string
  11. MsgID string
  12. Log *logger.Helper
  13. Error error
  14. Cache storage.AdapterCache
  15. }
  16. func (db *Service) AddError(err error) error {
  17. if db.Error == nil {
  18. db.Error = err
  19. } else if err != nil {
  20. db.Error = fmt.Errorf("%v; %w", db.Error, err)
  21. }
  22. return db.Error
  23. }