Documentation ¶
Index ¶
- Constants
- func CheckIfFileExists(path string) bool
- func ConvertInterfaceE(from any, to any) error
- func ConvertInterfaceP(from any, to any)
- func CreateFile(path string) (*os.File, error)
- func CustomError(message string, statusCode int) error
- func CustomErrorWithTrace(err error, message string, statusCode int) error
- func DeferCheck(function func() error)
- func DeleteFile(path string) error
- func DownloadFile(url, filePath string) error
- func EnableCORS(r *chi.Mux)
- func GenerateJsonResponse(w http.ResponseWriter, data interface{}, statusCode int, message string)
- func GetCurrentDir() string
- func GetExt(pathOrFilename string) string
- func LogAndPanicIfError(err error, message string)
- func LogDebug(message string, fields ...zap.Field)
- func LogError(message string, fields ...zap.Field)
- func LogFatal(message string, fields ...zap.Field)
- func LogIfError(err error)
- func LogInfo(message string, fields ...zap.Field)
- func LogPanic(message string, fields ...zap.Field)
- func PanicAppError(message string, statusCode int)
- func PanicIfAppError(err error, message string, statusCode int)
- func PanicIfError(err error)
- func PanicValidationError(errors []ValidationError, statusCode int)
- func ValidateBodyPayload(body io.ReadCloser, output interface{})
- func ValidateQueryParamInt(r *http.Request, queryName string) int
- func ValidateStruct(data interface{})
- func ValidateUrlParamUUID(r *http.Request, paramName string) uuid.UUID
- type AppError
- type BaseConfig
- type ParamType
- type Response
- type ResponseMap
- type ResponseSlice
- type ValidationError
- type ValidationErrors
Constants ¶
View Source
const ( TEST = "test" DEVELOPMENT = "development" STAGING = "staging" PRODUCTION = "production" )
Variables ¶
This section is empty.
Functions ¶
func CheckIfFileExists ¶
func ConvertInterfaceE ¶
func ConvertInterfaceP ¶
func CustomError ¶
func CustomErrorWithTrace ¶
func DeferCheck ¶
func DeferCheck(function func() error)
func DeleteFile ¶
func DownloadFile ¶
func EnableCORS ¶ added in v1.0.6
func EnableCORS(r *chi.Mux)
func GenerateJsonResponse ¶ added in v1.0.6
func GenerateJsonResponse(w http.ResponseWriter, data interface{}, statusCode int, message string)
func GetCurrentDir ¶
func GetCurrentDir() string
func LogAndPanicIfError ¶
func LogIfError ¶
func LogIfError(err error)
func PanicAppError ¶
func PanicIfAppError ¶
func PanicIfError ¶
func PanicIfError(err error)
func PanicValidationError ¶
func PanicValidationError(errors []ValidationError, statusCode int)
func ValidateBodyPayload ¶
func ValidateBodyPayload(body io.ReadCloser, output interface{})
func ValidateQueryParamInt ¶ added in v1.0.6
func ValidateStruct ¶
func ValidateStruct(data interface{})
Types ¶
type BaseConfig ¶
type BaseConfig struct { ServiceName string `mapstructure:"SERVICE_NAME"` ServiceEnv string `mapstructure:"SERVICE_ENV"` ServiceHost string `mapstructure:"SERVICE_HOST"` ServiceHttpPort string `mapstructure:"SERVICE_HTTP_PORT"` ServiceGrpcPort string `mapstructure:"SERVICE_GRPC_PORT"` GcpProjectId string `mapstructure:"GCP_PROJECT_ID"` PubsubDlq string `mapstructure:"PUBSUB_DLQ_TOPIC"` RedisHost string `mapstructure:"REDIS_HOST"` RedisPort string `mapstructure:"REDIS_PORT"` RedisUser string `mapstructure:"REDIS_USER"` RedisPassword string `mapstructure:"REDIS_PASSWORD"` RedisCacheExpire int `mapstructure:"REDIS_DEFAULT_CACHE_EXPIRE"` MongoHost string `mapstructure:"MONGO_HOST"` MongoPort string `mapstructure:"MONGO_PORT"` MongoUser string `mapstructure:"MONGO_USER"` MongoPassword string `mapstructure:"MONGO_PASSWORD"` MongoDb string `mapstructure:"MONGO_DATABASE"` PostgresHost string `mapstructure:"POSTGRES_HOST"` PostgresPort string `mapstructure:"POSTGRES_PORT"` PostgresUser string `mapstructure:"POSTGRES_USER"` PostgresPassword string `mapstructure:"POSTGRES_PASSWORD"` PostgresDb string `mapstructure:"POSTGRES_DATABASE"` ElasticsearchHost string `mapstructure:"ELASTICSEARCH_HOST"` ElasticsearchUser string `mapstructure:"ELASTICSEARCH_USER"` ElasticsearchPassword string `mapstructure:"ELASTICSEARCH_PASSWORD"` JaegerEnable bool `mapstructure:"JAEGER_ENABLE"` JaegerHost string `mapstructure:"JAEGER_HOST"` JaegerPort string `mapstructure:"JAEGER_PORT"` JaegerLogSpans bool `mapstructure:"JAEGER_LOG_SPANS"` S3Endpoint string `mapstructure:"S3_ENDPOINT"` S3AccessKey string `mapstructure:"S3_ACCESS_KEY"` S3SecretKey string `mapstructure:"S3_SECRET_KEY"` S3Region string `mapstructure:"S3_REGION"` S3PublicBucket string `mapstructure:"S3_PUBLIC_BUCKET"` S3PrivateBucket string `mapstructure:"S3_PRIVATE_BUCKET"` S3PublicUrl string `mapstructure:"S3_PUBLIC_URL"` S3PreSignedExpire int `mapstructure:"S3_PRESIGNED_EXPIRE"` }
func CheckAndSetConfig ¶
func CheckAndSetConfig(path string, configName string) *BaseConfig
func LoadBaseConfig ¶
func LoadBaseConfig(path string, configName string) (*BaseConfig, error)
type ResponseMap ¶ added in v1.0.6
type ResponseMap struct { StatusCode int `json:"status_code"` Status string `json:"status"` Message string `json:"message"` Data map[string]interface{} `json:"data,omitempty"` }
FOR TESTING PURPOSE
type ResponseSlice ¶ added in v1.0.6
type ResponseSlice struct { StatusCode int `json:"status_code"` Status string `json:"status"` Message string `json:"message"` Data []map[string]interface{} `json:"data,omitempty"` }
FOR TESTING PURPOSE
type ValidationError ¶
type ValidationError struct {
Message string
}
func (*ValidationError) Error ¶
func (ve *ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors struct { Errors []ValidationError StatusCode int }
func (*ValidationErrors) Error ¶
func (ve *ValidationErrors) Error() string
Click to show internal directories.
Click to hide internal directories.