Documentation
¶
Index ¶
- Constants
- func BoolEnv(key string) (bool, error)
- func IntEnv(key string) (int, error)
- func ParsePtrString(s *string) string
- func ParseStringNil(s string) *string
- func ParseStringToFloat64(str string, def float64) float64
- func ParseStringToInt(str string, def int) int
- func ParseStringToPhone(phone, defaultRegionCode string, phoneFormat phonenumbers.PhoneNumberFormat) (string, error)
- func StringEnv(key string) (string, error)
- func Stringify(str interface{}) string
- type JSON
- type JSend
- type Links
- type Meta
Constants ¶
const ( // RequestID Incoming request id RequestID = "request_id" // Bearer Bearer = "Bearer" // XRequestID HTTP request header key X-Request-ID XRequestID = "X-Request-ID" )
Variables ¶
This section is empty.
Functions ¶
func ParsePtrString ¶ added in v1.8.5
ParsePtrString function check pointer string, if nil return empty string
func ParseStringNil ¶ added in v1.8.5
ParseStringNil function to check string if empty return nil
func ParseStringToFloat64 ¶
ParseStringToFloat64 Parse string to float64, error return default value
func ParseStringToInt ¶
ParseStringToInt Parse string to int, error return default value
func ParseStringToPhone ¶ added in v1.8.6
func ParseStringToPhone(phone, defaultRegionCode string, phoneFormat phonenumbers.PhoneNumberFormat) (string, error)
ParseStringToPhone Function to parse string to formatted phone number See details documentation in https://github.com/nyaruka/phonenumbers defaultRegionCode using ISO 3166-Alpha 2
Types ¶
type JSend ¶
type JSend struct { Status string `json:"status"` Message string `json:"message,omitempty"` Data interface{} `json:"data,omitempty"` Meta *Meta `json:"meta,omitempty"` Code interface{} `json:"code,omitempty"` }
JSend used JSend format with some modification
func ErrorResponse ¶ added in v1.7.0
ErrorResponse is used return response with JSON format if failure in server side
func FailResponse ¶
FailResponse is used to return response with JSON format if failure from client side
func SuccessDataResponse ¶
SuccessDataResponse used to return response JSON format if have data value
func SuccessResponse ¶
func SuccessResponse() JSend
SuccessResponse used to return response with JSON format success