Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyMask ¶
ApplyMask keep the value of all given paths in the given proto message and clears the rest. Does not validate the field mask, this should be done before calling this function. A FieldMaskMap is created and then used for filtering the given proto message.
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor will apply field masks on all streamed responses from Server streamed endpoints if the request * ... implement the ReadMaskable interface * ... the field mask paths are not empty * ... the field mask paths are valid on the response message
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor will apply field masks on responses for unary endpoints if the request * ... implement the ReadMaskable interface * ... the field mask paths are not empty * ... the field mask paths are valid on the response message
Types ¶
type FieldMaskMap ¶
type FieldMaskMap map[string]FieldMaskMap
FieldMaskMap holds the information about which fields should be filtered in a protobuf message.
func NewMask ¶
func NewMask(paths []string) FieldMaskMap
NewMask creates a FieldMaskMap from the paths provided. Path parts are separated by "." for example "base.sub.key".
func (FieldMaskMap) Apply ¶
func (fm FieldMaskMap) Apply(msg proto.Message)
Apply the given proto message with the FieldMaskMap. Does not validate the field mask, this should be done before calling this function. Will keep all fields specified in the FieldMaskMap as is and clear the rest. If there are no paths in the FieldMaskMap all fields will be left as is.
type ReadMaskable ¶
type ReadMaskable interface {
GetReadMask() []string
}
ReadMaskable must be implemented by the requests for the interceptors to apply the field map on the responses.