protobuf

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFunc

func ExtractFunc() func(query.ExtractFunc) query.ExtractFunc

ExtractFunc is a function for query.CustomExtractFunc option to extract values by protobuf struct tag.

Example
v := testpb.OneofMessage{
	Value: &testpb.OneofMessage_B_{
		B: &testpb.OneofMessage_B{
			BarValue: "yyy",
		},
	},
}
q := query.New(
	query.CustomExtractFunc(protobufextractor.ExtractFunc()),
	query.CustomIsInlineStructFieldFunc(protobufextractor.OneofIsInlineStructFieldFunc()),
).Key("b").Key("bar_value")
got, err := q.Extract(v)
if err != nil {
	log.Fatal(err)
}
fmt.Println(got)
Output:

yyy

func OneofIsInlineStructFieldFunc

func OneofIsInlineStructFieldFunc() func(reflect.StructField) bool

OneofIsInlineStructFieldFunc is a function for query.CustomIsInlineStructFieldFunc option to enable extracting values even if the oneof field name is omitted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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