Documentation ¶
Index ¶
- Variables
- func Add(num1, num2 interface{}) float64
- func AddQueryParam(urlStr *string, paramKey string, paramValue string) error
- func CleanStringInput(input string) string
- func CompareHash(str string, hashed string) bool
- func ConvertIntValues(m map[string]interface{})
- func ConvertStringInterfaceToStringFloat(originalMap map[string]interface{}) map[string]float64
- func CopyStruct(src, dst interface{})
- func EmailValid(email string) (string, bool)
- func FindTemplateFilePath(templateName string, templateTypePath string) (string, error)
- func FormatDate(date, currentISOFormat, newISOFormat string) (string, error)
- func FormatInspectionPeriod(t interface{}) string
- func GenerateGroupByURL(appUrl, path string, querys map[string]string) string
- func GenerateOTP(max int) (int, error)
- func GenerateUUID() string
- func GetConstants(pkgImportPath string) (map[string]string, error)
- func GetHeader(c *gin.Context, key string) string
- func GetRandomNumbersInRange(min, max int) int
- func GetUnixString(date, currentISOFormat, newISOFormat string) (string, error)
- func GetUnixTime(date, currentISOFormat, newISOFormat string) (int, error)
- func HashPassword(str string) (string, error)
- func Header2Map(header http.Header) map[string]interface{}
- func InIntSlice(value int, strSlice []int) bool
- func InStringSlice(value string, strSlice []string) bool
- func IsValidUUID(id string) bool
- func LogAndPrint(logger *Logger, data interface{}, args ...interface{})
- func NumberFormat(t interface{}) float64
- func PercentageOf(actualNumber, percentage float64) float64
- func PhoneValid(phone string) (string, bool)
- func RandomString(length int) string
- func RemoveKey(p interface{}, key string)
- func RemoveString(slice []string, s string) []string
- func SpewResultForDebugging(description string, v interface{})
- func Stripslashes(s string) string
- func StructToMap(obj interface{}) (map[string]interface{}, error)
- func URLDecode(encodedString string) (string, error)
- func UrlHasQuery(urlString string) (bool, error)
- func ValidationResponse(err error, validate *validator.Validate) validator.ValidationErrorsTranslations
- type AuditLog
- type LogRecord
- type Logger
- func (l *Logger) Audit(record *AuditLog)
- func (l *Logger) Debug(arg0 interface{}, args ...interface{})
- func (l *Logger) Error(arg0 interface{}, args ...interface{})
- func (l *Logger) Fatal(arg0 interface{}, args ...interface{})
- func (l *Logger) Info(arg0 interface{}, args ...interface{})
- func (l *Logger) Warning(arg0 interface{}, args ...interface{})
- type Response
- func BuildErrorResponse(code int, status string, message string, err interface{}, data interface{}, ...) Response
- func BuildSuccessResponse(code int, message string, data interface{}, pagination ...interface{}) Response
- func ResponseMessage(code int, status string, name string, message string, err interface{}, ...) Response
- func UnauthorisedResponse(code int, status string, name string, message string) Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AppDir string AppDirErr error )
Functions ¶
func CleanStringInput ¶
func CompareHash ¶
func ConvertIntValues ¶
func ConvertIntValues(m map[string]interface{})
func CopyStruct ¶
func CopyStruct(src, dst interface{})
func EmailValid ¶
func FindTemplateFilePath ¶
func FormatDate ¶
func FormatInspectionPeriod ¶
func FormatInspectionPeriod(t interface{}) string
func GenerateGroupByURL ¶
func GenerateOTP ¶
func GenerateUUID ¶
func GenerateUUID() string
func GetRandomNumbersInRange ¶
func GetUnixString ¶
func GetUnixTime ¶
func HashPassword ¶
func Header2Map ¶
func InIntSlice ¶
func InStringSlice ¶
func IsValidUUID ¶
func LogAndPrint ¶
func LogAndPrint(logger *Logger, data interface{}, args ...interface{})
func NumberFormat ¶
func NumberFormat(t interface{}) float64
func PercentageOf ¶
func PhoneValid ¶
func RandomString ¶
func RemoveString ¶
func SpewResultForDebugging ¶
func SpewResultForDebugging(description string, v interface{})
func Stripslashes ¶
func StructToMap ¶
func UrlHasQuery ¶
func ValidationResponse ¶
func ValidationResponse(err error, validate *validator.Validate) validator.ValidationErrorsTranslations
Types ¶
type AuditLog ¶
type AuditLog struct { Date time.Time `json:"date"` Username string `json:"Username"` RequestHeader interface{} `json:"request_header"` Request interface{} `json:"request"` StatusCode int `json:"status_code"` ResponseHeader interface{} `json:"response_header"` Response interface{} `json:"response"` ClientID string `json:"client_id"` Route string `json:"route"` Duration float64 `json:"duration (seconds)"` }
AuditLog Audit log
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger application logger
func (*Logger) Debug ¶
func (l *Logger) Debug(arg0 interface{}, args ...interface{})
Debug log debug
func (*Logger) Error ¶
func (l *Logger) Error(arg0 interface{}, args ...interface{})
Error log errors
func (*Logger) Fatal ¶
func (l *Logger) Fatal(arg0 interface{}, args ...interface{})
Fatal log fatal errors
type Response ¶
type Response struct { Status string `json:"status,omitempty"` StatusCode int `json:"status_code,omitempty"` Name string `json:"name,omitempty"` //name of the error Message string `json:"message,omitempty"` Error interface{} `json:"error,omitempty"` //for errors that occur even if request is successful Data interface{} `json:"data,omitempty"` Pagination interface{} `json:"pagination,omitempty"` Extra interface{} `json:"extra,omitempty"` }
func BuildErrorResponse ¶
func BuildErrorResponse(code int, status string, message string, err interface{}, data interface{}, logger ...bool) Response
BuildErrorResponse method is to inject data value to dynamic failed response
func BuildSuccessResponse ¶
func BuildSuccessResponse(code int, message string, data interface{}, pagination ...interface{}) Response
BuildResponse method is to inject data value to dynamic success response
Click to show internal directories.
Click to hide internal directories.