Documentation ¶
Index ¶
- Constants
- func ApiErrorWithCode(c codes.Code) error
- func ApiErrorWithCodeAndMessage(c codes.Code, msg string, args ...interface{}) error
- func ErrorHandler(logger hclog.Logger) runtime.ErrorHandlerFunc
- func ForbiddenError() error
- func InvalidArgumentErrorf(msg string, fields map[string]string) error
- func MaskContains(paths []string, s string) bool
- func NotFoundError() error
- func NotFoundErrorf(msg string, a ...interface{}) error
- func OutgoingInterceptor(ctx context.Context, w http.ResponseWriter, m proto.Message) error
- func ProtoToStruct(p proto.Message) (*structpb.Struct, error)
- func StructToProto(fields *structpb.Struct, p proto.Message) error
- func UnauthenticatedError() error
- func ValidId(prefix, id string) bool
- func ValidNameDescription(in string) bool
- func ValidateCreateRequest(i ApiResource, fn CustomValidatorFunc) error
- func ValidateDeleteRequest(prefix string, r DeleteRequest, fn CustomValidatorFunc) error
- func ValidateGetRequest(prefix string, r GetRequest, fn CustomValidatorFunc) error
- func ValidateUpdateRequest(prefix string, r UpdateRequest, i ApiResource, fn CustomValidatorFunc) error
- type ApiResource
- type CustomValidatorFunc
- type DeleteRequest
- type GetRequest
- type MaskManager
- type UpdateRequest
Constants ¶
const ( HttpOnlyCookieName = "wt-http-token-cookie" JsVisibleCookieName = "wt-js-token-cookie" )
Variables ¶
This section is empty.
Functions ¶
func ApiErrorWithCode ¶
ApiErrorWithCode returns an api error with the provided code.
func ApiErrorWithCodeAndMessage ¶
ApiErrorWithCodeAndMessage returns an api error with the provided code and message.
func ErrorHandler ¶
func ErrorHandler(logger hclog.Logger) runtime.ErrorHandlerFunc
func ForbiddenError ¶
func ForbiddenError() error
func MaskContains ¶
func NotFoundError ¶
func NotFoundError() error
NotFoundError returns an ApiError indicating a resource couldn't be found.
func NotFoundErrorf ¶
NotFoundErrorf returns an ApiError indicating a resource couldn't be found.
func OutgoingInterceptor ¶
func UnauthenticatedError ¶
func UnauthenticatedError() error
func ValidNameDescription ¶ added in v0.1.1
func ValidateCreateRequest ¶
func ValidateCreateRequest(i ApiResource, fn CustomValidatorFunc) error
func ValidateDeleteRequest ¶
func ValidateDeleteRequest(prefix string, r DeleteRequest, fn CustomValidatorFunc) error
func ValidateGetRequest ¶
func ValidateGetRequest(prefix string, r GetRequest, fn CustomValidatorFunc) error
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(prefix string, r UpdateRequest, i ApiResource, fn CustomValidatorFunc) error
Types ¶
type ApiResource ¶
type CustomValidatorFunc ¶
var NoopValidatorFn CustomValidatorFunc = func() map[string]string { return nil }
type DeleteRequest ¶
type DeleteRequest interface {
GetId() string
}
type GetRequest ¶
type GetRequest interface {
GetId() string
}
type MaskManager ¶
func NewMaskManager ¶
func NewMaskManager(dest protoreflect.ProtoMessage, src ...protoreflect.ProtoMessage) (MaskManager, error)
NewMaskManager returns a mask manager that can translate field masks into the first proto from all subsequent protos assuming they are both using the mask_mapping custom option. Error is returned if no mappings are found or if one of the passed protos has a mapping that doesn't reciprocate.
func (MaskManager) Translate ¶
func (m MaskManager) Translate(paths []string) []string
Translate takes a field mask's paths and returns paths translated for the destination's protobuf.
type UpdateRequest ¶
type UpdateRequest interface { GetId() string GetUpdateMask() *field_mask.FieldMask }