protosource

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package protosource reads the facts about a protobuf message's fields: each field's name, its Go name, its kind, and its options as annotations.

A field option's key is the option's full name, such as "classification.data_categories", and its values are the option's values as strings. A policy matches on them with policy.Key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoName

func GoName(protoName string) string

GoName is the Go field name protoc-gen-go gives a proto field: its GoCamelCase, word for word. A word starts at an underscore or a capital; a digit is a word of its own, so the letter after it starts a new word (foo_1bar is Foo_1Bar, sha256sum is Sha256Sum); an underscore before a lower-case letter is dropped and the letter capitalised; a leading underscore becomes X (_x is XX); a dot becomes an underscore.

func New

func New() policy.Source

New returns the source. The message given to policy.ForMessage must be a generated protobuf message, such as &pb.Individual{}.

Types

This section is empty.

Directories

Path Synopsis
internal
testpb
Package testpb is protoc-gen-go output for the protosource tests: the two messages of docs/plans/2026-10-04-plan-builder/proto, where classification.data_categories is a repeated string field option.
Package testpb is protoc-gen-go output for the protosource tests: the two messages of docs/plans/2026-10-04-plan-builder/proto, where classification.data_categories is a repeated string field option.

Jump to

Keyboard shortcuts

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