compose

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package compose 承载需要多次调用上游才能完成的读取(跨接口组合, 见 docs/adr/shared-boundary-engine.md「引入真正的 use-case 层」的触发条件)。

每一步仍是一个 endpoint 声明、经 engine.Execute 执行;这里只负责编排步骤与分页。 gRPC service、CLI 与其它前端都调这里,不得各自再拼一遍。

组合用到的 endpoint 都是 AuthOptional:调用方经 ctx 带了网易云 cookie(gRPC 的 x-netease-cookie、CLI 的本地登录态)就用它,没带就匿名,任何情况下都不借用会话池。 因此 engine.Execute 与 CLI 惯用的 ExecuteWithCookie 在这里的凭据行为一致。

Index

Constants

View Source
const MaxPageSize = songendpoint.MaxDetails

MaxPageSize 是单页上限,超过时按上限返回。批量歌曲详情一次最多 1000 首, 用户歌单的上游单页也按这个数取。

Variables

This section is empty.

Functions

func PlaylistTracks

func PlaylistTracks(ctx context.Context, eng *engine.Engine, req *mmpb.AllTracksRequest) (*mmpb.AllTracksResponse, error)

PlaylistTracks 按歌单原顺序分页返回歌曲(对外的 AllTracks)。

歌单详情内嵌的 tracks 会被上游截断,只有 trackIds 完整:先取完整 trackIds, 切出这一页,再批量查这一页的歌曲详情。total 是歌单的歌曲总数; offset 超出总数时返回空页,不再请求歌曲详情。

func UserPlaylists

UserPlaylists 返回用户歌单的一页(对外的 UserPlaylist)。

上游分页不能直接透传:第一页会在 limit 之外额外插入「喜欢的音乐」,不返回总数, 创建 / 收藏的筛选也只能在拿到数据后做(先分页再筛选会得到短页、漏项)。所以按上游 单页上限取全量,再筛选、分页;total 是筛选后的总数,不随 limit / offset 变化。 「喜欢的音乐」的创建者就是用户本人,计入 ALL 与 CREATED。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL