record

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 9 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 record owns the stable Pixiv record projection shared by CLI and MCP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	// contains filtered or unexported fields
}

Record 是可在 CLI 管道和 MCP 之间共享的 Pixiv 实体 JSON 记录。 它保留源对象和外部程序提供的未知字段,同时固定顶层 id、type、url。

func NewIdentityRecord

func NewIdentityRecord(id int64, recordType, rawURL string) (Record, error)

NewIdentityRecord 构造只包含 Pixiv canonical identity 的管道记录。 artwork 表示尚无法可靠判断 illust/manga/ugoira 子类型的作品身份。

func ParseRecordJSON

func ParseRecordJSON(line []byte) (Record, error)

ParseRecordJSON 解析一行 NDJSON 中的单个对象,并保留未知字段。

func RecordFromArtworkDTO

func RecordFromArtworkDTO(artwork pixiv.ArtworkDTO) (Record, error)

RecordFromArtworkDTO 将显式 DTO 映射为管道记录。运行时 SDK 模型必须先在 产品包内完成字段级转换,记录层不再通过反射猜测或脱敏运行时字段。

func RecordFromNovelContentDTO added in v1.0.2

func RecordFromNovelContentDTO(content pixiv.NovelContentDTO) (Record, error)

RecordFromUserPreviewDTO 将用户预览 DTO 映射为管道记录。 RecordFromNovelContentDTO 将结构化小说正文映射为可继续管道处理的小说记录。

func RecordFromNovelDTO

func RecordFromNovelDTO(novel pixiv.NovelDTO) (Record, error)

RecordFromNovelDTO 将小说 DTO 映射为管道记录。

func RecordFromUserDetailDTO

func RecordFromUserDetailDTO(detail pixiv.UserDetailDTO) (Record, error)

RecordFromUserDetailDTO 将用户详情 DTO 映射为管道记录。

func RecordFromUserPreviewDTO

func RecordFromUserPreviewDTO(preview pixiv.UserPreviewDTO) (Record, error)

func (Record) ID

func (r Record) ID() string

ID 返回记录的稳定字符串标识。

func (Record) MarshalJSON

func (r Record) MarshalJSON() ([]byte, error)

MarshalJSON 保留记录中的未知字段,并始终输出一个 JSON 对象。

func (Record) Matches

func (r Record) Matches(filter RecordFilter) bool

Matches 判断记录是否满足所有已设置的筛选条件,不修改记录内容。

func (Record) Type

func (r Record) Type() string

Type 返回记录的实体类型。

func (Record) URL

func (r Record) URL() string

URL 返回记录的规范 Pixiv URL。

func (*Record) UnmarshalJSON

func (r *Record) UnmarshalJSON(data []byte) error

UnmarshalJSON 让 MCP structured content 等 JSON 消费者可以把 records 重新解码为 Record,同时复用 NDJSON 输入的完整校验、ID 归一与版本元数据清理规则。

type RecordFilter

type RecordFilter struct {
	ID           string
	Type         string
	Tags         []string
	MinViews     *int64
	MinPageCount *int64
}

RecordFilter 描述基于稳定记录字段的本地筛选条件。 MinViews 和 MinPageCount 为 nil 时不筛选对应字段。

Jump to

Keyboard shortcuts

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