servicegen

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 7 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 servicegen 从 proto 生成 internal/service 的一行转发胶水。

service 的绝大多数方法恒一行转发 engine.Execute / engine.ExecuteWithCookie, 手写它们唯一的产出是复制粘贴漂移。本包以 proto 编译进 gen/ 的 descriptor 为准逐 rpc 生成;每个 rpc 必须在 spec 里显式登记为「转发到某 endpoint 变量」 或「手写」,未登记即报错——新增 rpc 不可能静默漏掉 service 层(新鲜度测试 会红,见 internal/service 的 freshness 测试)。

产物是 internal/service/<service>_gen.go(提交进版本控制,同 gen/ 与 docs/cmd/ 的策略);Server 结构体、构造器与手写方法留在同名 .go 文件。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// Name 是相对 internal/service 的文件名(如 song_gen.go)。
	Name string
	// Content 是格式化后的 Go 源码。
	Content []byte
}

File 是一个生成产物。

func Generate

func Generate() ([]File, error)

Generate 生成全部 service 转发文件。proto 里出现未登记的 rpc 时返回错误—— 调用方(生成器 / 新鲜度测试)据此强制显式选择转发或手写。

Jump to

Keyboard shortcuts

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