Documentation ¶
Index ¶
Constants ¶
View Source
const (
// MaxLimit is the maximum limit value for pagination.
MaxLimit = 500
)
Variables ¶
View Source
var ( // ErrBadRequest is the returned standard error for bad requests. ErrBadRequest = status.Error(codes.InvalidArgument, "bad request") // ErrInvalidLimit is the returned standard error for invalid limit for pagination. ErrInvalidLimit = status.Errorf(codes.InvalidArgument, "Bad request: limit is required and must be <= %d", MaxLimit) // ErrNotFound is the returned standard error for value(s) not found. ErrNotFound = status.Error(codes.NotFound, "not found") // ErrDuplicateRecord is the returned standard error for finding duplicates. ErrDuplicateRecord = status.Error(codes.AlreadyExists, "duplicate record") // ErrInternal is the returned standard error for an internal error. ErrInternal = status.Error(codes.Internal, "internal server error") // ErrorPassthroughSet is the default set of errors that will be passed through by // MapAndFilterErrors without blocking or mapping. ErrorPassthroughSet = map[error]bool{ ErrBadRequest: true, ErrInvalidLimit: true, ErrNotFound: true, ErrDuplicateRecord: true, ErrInternal: true, grpcutil.ErrPermissionDenied: true, } // ErrorMapping is the default mapping of errors used by MapAndFilterErrors to, for example, // map errors from other application layers to what an API package will want to return. ErrorMapping = map[error]error{ db.ErrNotFound: ErrNotFound, db.ErrDuplicateRecord: ErrDuplicateRecord, db.ErrInvalidInput: ErrBadRequest, } )
Functions ¶
Types ¶
type FieldMask ¶
type FieldMask struct {
// contains filtered or unexported fields
}
FieldMask is a utility type for efficiently interacting with protobuf FieldMasks in a compliant way.
func NewFieldMask ¶
func NewFieldMask(m *field_mask.FieldMask) FieldMask
NewFieldMask initializes a FieldMask object from a protobuf FieldMask pointer. A passed-in nil or a FieldMask with zero paths will result in an empty FieldMask, which is considered to contain every field.
func (*FieldMask) FieldInSet ¶
FieldInSet answers whether the passed-in field is in the FieldMask. FieldInSet respects the FieldMask convention of treating empty FieldMasks as containing every field.
Click to show internal directories.
Click to hide internal directories.