Versions in this module Expand all Collapse all v1 v1.1.72 Jun 5, 2024 Changes in this version + type Options struct + Headers map[string]string + Proxy string v1.1.71 Jun 4, 2024 v1.1.70 May 28, 2024 Changes in this version + const DEVELOPMENT + const PRODUCTION + const STAGING + const TEST + func BuildCacheKey(key string, identifier string, funcName string, args ...any) string + func BuildPrefixKey(keys ...string) string + func CheckIfFileExists(path string) bool + func ComparedPassword(hashedPassword string, password string) error + 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 ExecSession(ctx context.Context, client *mongo.Client, fn func(mongo.SessionContext) error) error + func ExecSessionWithRetry(ctx context.Context, client *mongo.Client, fn func(mongo.SessionContext) error) error + func ExecTx(ctx context.Context, pgxPool *pgxpool.Pool, fn func(tx pgx.Tx) error) error + func ExecTxWithRetry(ctx context.Context, pgxPool *pgxpool.Pool, fn func(tx pgx.Tx) error) error + func Fetch(url string, headers ...map[string]string) (*goquery.Document, error) + func FetchFile(url string) (*os.File, error) + func GenerateJsonResponse(w http.ResponseWriter, data interface{}, statusCode int, message string) + func GetCurrentDir() string + func GetExt(pathOrFilename string) string + func HashedPassword(password string) (string, error) + func ImageUriToBase64(uri string) (string, error) + 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 Marshal(v any) ([]byte, error) + func NewDecoder(r io.Reader) *jsoniter.Decoder + func NewEncoder(w io.Writer) *jsoniter.Encoder + func PanicAppError(message string, statusCode int) + func PanicIfAppError(err error, message string, statusCode int) + func PanicIfAppErrorWithTrace(ctx context.Context, err error, message string, statusCode int) + func PanicIfError(err error) + func PanicValidationError(errors []ValidationError, statusCode int) + func Unmarshal(data []byte, v any) error + 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 struct + Message string + StatusCode int + func (ae *AppError) Error() string + type BaseConfig struct + ElasticsearchHost []string + ElasticsearchLogging bool + ElasticsearchPassword string + ElasticsearchUser string + GcpProjectId string + JaegerEnable bool + JaegerHost string + JaegerLogSpans bool + JaegerPort string + JwtAccessTokenExpire time.Duration + JwtRefreshTokenExpire time.Duration + JwtSecretKey string + KafkaAutoCommit bool + KafkaAutoTopicCreation bool + KafkaBrokers []string + KafkaDlqRetry int + KafkaDlqTopic string + KafkaGroupID string + KafkaReplicationFactor int + KafkaTopics []string + MongoDb string + MongoHost string + MongoPassword string + MongoPort string + MongoReplicaSet string + MongoUser string + PostgresDb string + PostgresHost string + PostgresPassword string + PostgresPort string + PostgresUser string + PubsubDlq string + RedisCacheExpire int + RedisHost string + RedisPassword string + RedisPort string + RedisUser string + S3AccessKey string + S3Endpoint string + S3PreSignedExpire time.Duration + S3PrivateBucket string + S3PublicBucket string + S3PublicUrl string + S3Region string + S3SecretKey string + ServiceEnv string + ServiceGrpcPort string + ServiceHost string + ServiceHttpPort string + ServiceName string + func CheckAndSetConfig(path string, configName string) *BaseConfig + func LoadBaseConfig(path string, configName string) (*BaseConfig, error) + type Pagination struct + Limit int + Page int + Rows []T + SearchField string + SearchValue string + Sort string + TotalPages int + TotalRows int + func Paginate[T any](pagination *Pagination[T], rows []T) *Pagination[T] + func ValidatePagination[T any](r *http.Request) *Pagination[T] + type ParamType interface + type Response struct + Data T + Message string + Status string + StatusCode int + type ResponseMap struct + Data map[string]interface{} + Message string + Status string + StatusCode int + type ResponseSlice struct + Data []map[string]interface{} + Message string + Status string + StatusCode int + type ValidationError struct + Message string + func (ve *ValidationError) Error() string + type ValidationErrors struct + Errors []ValidationError + StatusCode int + func (ve *ValidationErrors) Error() string