Documentation ¶
Index ¶
- func GoValToProtoStruct(v interface{}) (*structpb.Value, error)
- func ProtoStructToGoVal(v *structpb.Value, into interface{}) error
- func ReadJSON(r *http.Request, into any) error
- func WriteErr(w http.ResponseWriter, err error)
- func WriteErrMsg(w http.ResponseWriter, statusCode int, message string)
- func WriteJSON(w http.ResponseWriter, status int, v interface{})
- type ListResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoValToProtoStruct ¶
func ProtoStructToGoVal ¶
func WriteErr ¶
func WriteErr(w http.ResponseWriter, err error)
WriteErr interprets the given error as one of the errors defined in errors package and writes the error response.
func WriteErrMsg ¶ added in v0.7.9
func WriteErrMsg(w http.ResponseWriter, statusCode int, message string)
WriteErr interprets the given error as one of the errors defined in errors package and writes the error response.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, v interface{})
WriteJSON writes 'v' to response-writer in JSON format.
Types ¶
type ListResponse ¶
type ListResponse[T any] struct { Items []T `json:"items"` }
ListResponse can be used to write list of items to response. This format is helpful in enabling pagination.
Click to show internal directories.
Click to hide internal directories.