com_base_batch_all.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package services
  2. import (
  3. "app/commons/model/entity"
  4. "gorm.io/gorm"
  5. )
  6. // tips:
  7. // 分批查询表中所有数据 --
  8. // 对数据量很大的表适用 --推荐使用
  9. func (s *CommonService) BatchUser(db *gorm.DB) ([]*entity.User, error) {
  10. return FindAllWithBatch[entity.User](db)
  11. }
  12. func (s *CommonService) BatchUserLogs(db *gorm.DB) ([]*entity.UserLogs, error) {
  13. return FindAllWithBatch[entity.UserLogs](db)
  14. }
  15. func (s *CommonService) BatchUserQuota(db *gorm.DB) ([]*entity.UserQuota, error) {
  16. return FindAllWithBatch[entity.UserQuota](db)
  17. }
  18. func (s *CommonService) BatchAssets(db *gorm.DB) ([]*entity.Asset, error) {
  19. return FindAllWithBatch[entity.Asset](db)
  20. }
  21. func (s *CommonService) BatchTransferRecord(db *gorm.DB) ([]*entity.AssetRwRecord, error) {
  22. return FindAllWithBatch[entity.AssetRwRecord](db)
  23. }
  24. func (s *CommonService) BatchAssetRwCallbackLog(db *gorm.DB) ([]*entity.AssetRwCallbackLog, error) {
  25. return FindAllWithBatch[entity.AssetRwCallbackLog](db)
  26. }
  27. func (s *CommonService) BatchNodeOrder(db *gorm.DB) ([]*entity.NodeOrder, error) {
  28. return FindAllWithBatch[entity.NodeOrder](db)
  29. }