optionmerge

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package optionmerge provides shared merge logic for the three protoc-gen-servora-* plugins (authn, authz, audit). All three follow identical semantics:

  • method-level rule with mode != 0 (UNSPECIFIED) fully replaces the service default,
  • method-level rule absent or mode == 0 inherits the service default,
  • if neither contributes a non-zero mode, no rule applies.

"Mode" is conventionally the first field (field number 1) in each rule proto message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge[T proto.Message](svcDefault, methodRule T, hasMethod bool) (T, bool)

Merge returns the effective rule after applying service-level / method-level merge semantics. The result is always a deep clone so callers may mutate it.

hasMethod should be true if the method-level annotation was present in the proto descriptor (even if methodRule itself is non-nil, hasMethod == false means the annotation was absent and the caller pre-allocated a nil value).

Returns (result, true) when a usable rule exists; (zero, false) when neither side declares a non-UNSPECIFIED mode.

Types

This section is empty.

Jump to

Keyboard shortcuts

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