engine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFieldTags

func ApplyFieldTags(existingTag string, fieldTags *run.FieldTags) string

ApplyFieldTags applies the run.tags extension to existing struct tags

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase converts snake_case to CamelCase (for reverse matching)

Types

type FieldMatcher

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

FieldMatcher matches proto fields to Go struct fields

func NewFieldMatcher

func NewFieldMatcher() *FieldMatcher

NewFieldMatcher creates a new FieldMatcher

func (*FieldMatcher) FindProtoField

func (m *FieldMatcher) FindProtoField(
	goMessageName string,
	goFieldName string,
	tagsMap FieldTagsMap,
) string

FindProtoField finds the proto key for a Go struct field Returns the key in format "proto.package.Message.field_name" or empty string if not found

type FieldTagsMap

type FieldTagsMap map[string]*run.FieldTags

FieldTagsMap maps proto field identifiers to their tag directives Key format: "package.Message.field_name"

type GoFileEditor

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

GoFileEditor modifies pb.go files to inject custom struct tags

func NewGoFileEditor

func NewGoFileEditor(log logger.Logger) *GoFileEditor

NewGoFileEditor creates a new GoFileEditor with the provided logger

func (*GoFileEditor) EditGoFile

func (e *GoFileEditor) EditGoFile(goFile string, matcher *FieldMatcher, tagsMap FieldTagsMap) error

EditGoFile modifies a single Go file with the provided field tags

func (*GoFileEditor) ProcessString

func (e *GoFileEditor) ProcessString(content string, matcher *FieldMatcher, tagsMap FieldTagsMap, filename string) (string, error)

ProcessString processes Go source code from a string and returns the modified string This is used by the buf plugin which works with in-memory content

type ProtoReader

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

ProtoReader reads proto files and extracts run.tags extensions

func NewProtoReader

func NewProtoReader(log logger.Logger, includePaths []string) *ProtoReader

NewProtoReader creates a new ProtoReader

func (*ProtoReader) ReadProtoFiles

func (r *ProtoReader) ReadProtoFiles(protoFiles []string) (FieldTagsMap, error)

ReadProtoFiles reads proto files and extracts field tags

type TagItem

type TagItem struct {
	Key   string
	Value string
}

TagItem represents a single struct tag key-value pair

type TagItems

type TagItems []TagItem

TagItems is a collection of struct tags

func ParseTags

func ParseTags(tag string) TagItems

ParseTags parses a Go struct tag string into TagItems

func (TagItems) Format

func (ti TagItems) Format() string

Format converts TagItems to the Go struct tag format

Jump to

Keyboard shortcuts

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