MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / ListUserNodeUsage

Method ListUserNodeUsage

internal/store/postgres/users.go:371–385  ·  view source on GitHub ↗
(userID string)

Source from the content-addressed store, hash-verified

369}
370
371func (s *UserStore) ListUserNodeUsage(userID string) ([]users.UserNodeUsage, error) {
372 rows, err := sqlcgen.New(s.db).ListUserNodeUsage(context.Background(), userID)
373 if err != nil {
374 return nil, fmt.Errorf("list user node usage: %w", err)
375 }
376 out := make([]users.UserNodeUsage, 0, len(rows))
377 for _, r := range rows {
378 out = append(out, users.UserNodeUsage{
379 NodeID: r.NodeID,
380 UploadBytes: r.UploadBytes,
381 DownloadBytes: r.DownloadBytes,
382 })
383 }
384 return out, nil
385}
386
387// ListTodayUserStats 返回今日有流量的用户统计(跨节点合并),按总流量降序。
388func (s *UserStore) ListTodayUserStats(limit int) ([]users.TodayUserStat, error) {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
ListUserNodeUsageMethod · 0.65

Tested by

no test coverage detected