Documentation
¶
Overview ¶
Package fieldmask provides protobuf field masking for projections and updates.
It follows Google API Improvement Proposal guidelines by default, but provides options that allow it to fall back to the behavior of basic FieldMask documentation.
Index ¶
- type FieldMask
- func (fm *FieldMask[T]) Append(path string) error
- func (fm *FieldMask[T]) Clone(msg T) T
- func (fm *FieldMask[T]) Mask(msg T)
- func (fm *FieldMask[T]) Paths() []string
- func (fm *FieldMask[T]) Proto() *fieldmaskpb.FieldMask
- func (fm *FieldMask[T]) String() string
- func (fm *FieldMask[T]) Update(dst, src T) error
- type FieldName
- type MaskUnknowns
- type Option
- func WithExtensions(allow bool) Option
- func WithFieldName(mode FieldName, strict bool) Option
- func WithMaskUnknowns(mode MaskUnknowns) Option
- func WithMessageDescriptor(desc protoreflect.MessageDescriptor) Option
- func WithUpdateRepeated(mode UpdateRepeated) Option
- func WithUpdateUnknowns(mode UpdateUnknowns) Option
- type UpdateRepeated
- type UpdateUnknowns
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldMask ¶
func (*FieldMask[T]) Proto ¶
func (fm *FieldMask[T]) Proto() *fieldmaskpb.FieldMask
type FieldName ¶
type FieldName int
FieldName specifies which field name to prefer when parsing and outputting paths.
type MaskUnknowns ¶
type MaskUnknowns int
MaskUnknowns specifies how to handle unknown fields when a message is masked.
const ( // MaskRemovesUnknowns removes any unknown fields when a message is masked. // This is the default behavior. MaskRemovesUnknowns MaskUnknowns = iota // MaskRetainsUnknowns retains any unknown fields when a message is masked. MaskRetainsUnknowns )
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithExtensions ¶
WithExtensions returns an option that sets whether extensions are allowed.
func WithFieldName ¶
WithFieldName returns an option that sets the given mode for field names. If strict is false, either name will be accepted when parsing paths. The specified mode is always used when outputing paths.
func WithMaskUnknowns ¶
func WithMaskUnknowns(mode MaskUnknowns) Option
WithMaskUnknowns returns an option that sets the given mode for masking unknown fields.
func WithMessageDescriptor ¶
func WithMessageDescriptor(desc protoreflect.MessageDescriptor) Option
WithMessageDescriptor returns an option that sets the message descriptor. This is useful for dynamic types constructed at runtime.
func WithUpdateRepeated ¶
func WithUpdateRepeated(mode UpdateRepeated) Option
WithUpdateRepeated returns an option that sets the given mode for updating repeated fields.
func WithUpdateUnknowns ¶
func WithUpdateUnknowns(mode UpdateUnknowns) Option
WithUpdateUnknowns returns an option that sets the given mode for updating unknown fields.
type UpdateRepeated ¶
type UpdateRepeated int
UpdateRepeated specifies how to update repeated fields.
const ( // UpdateReplacesRepeated replaces any repeated fields on an update. // This is the default behavior. UpdateReplacesRepeated UpdateRepeated = iota // UpdateAppendsRepeated appends any repeated fields on an update. UpdateAppendsRepeated )
type UpdateUnknowns ¶
type UpdateUnknowns int
UpdateUnknowns specifies how to update unknown fields.
const ( // UpdateRetainsUnknowns retains any unknown fields on the destination message // when it's updated. This is the default behavior. UpdateRetainsUnknowns UpdateUnknowns = iota // UpdateAppendsUnknowns appends any unknown fields from the source message // to any unknown fields on the destination message when it's updated. UpdateAppendsUnknowns // UpdateReplacesUnknowns replaces any unknown fields on the destination message // with any unknown fields from the source message when it's updated. UpdateReplacesUnknowns )