Documentation ¶
Index ¶
- func MustConnGRPC(ctx context.Context, conn **grpc.ClientConn, addr string)
- func MustMapEnv(target *string, envKey string)
- func RandomString(length int) string
- func RespondError(w http.ResponseWriter, code int, msg string) error
- func RespondJSON(w http.ResponseWriter, data interface{}) error
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustConnGRPC ¶
func MustConnGRPC(ctx context.Context, conn **grpc.ClientConn, addr string)
MustConnGRPC connect grpc client to target address
func MustMapEnv ¶
MustMapEnv map service address to target address string
func RandomString ¶
RandomString generate random string with lower case alphabets and digits
func RespondError ¶
func RespondError(w http.ResponseWriter, code int, msg string) error
RespondError responds to a HTTP request with body of ErrorResponse
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, data interface{}) error
RespondJSON responds with arbitrary data objects
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse is a common struct for responding error for HTTP requests
Click to show internal directories.
Click to hide internal directories.