kekasigohelper

package module
v1.0.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 22 Imported by: 7

README

License

FOSSA Status

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken             = errors.New("Invalid authorization token")
	ErrInvalidTokenType         = errors.New("Authorization token type does not match")
	ErrNotMatchTokenCredentials = errors.New("Authorization token credentials do not match")
	ErrInvalidTokenCredentials  = errors.New("Invalid authorization token credentials")
	ErrInvalidTokenExpired      = errors.New("Authorization token has expired")
	ErrUsername                 = errors.New("Please Check again your Username")
	ErrPassword                 = errors.New("Please Check again your Password")
	LoginFailedMessage          = errors.New("please check username and password")
)

authValidation

View Source
var (
	ErrInternalServerError = errors.New("Internal Server Error")
	ErrNotFound            = errors.New("Your requested Item is not found")
	ErrUnAuthorize         = errors.New("Unauthorize")
	ErrBadParamInput       = errors.New("Bad Request")
	ErrPublicKey           = errors.New("invalid Public Key")
	ErrInvalidDataType     = errors.New("invalid data type")
	ErrIsRequired          = errors.New("is required")
	ErrInvalidValue        = errors.New("invalid value")
	ErrForbidden           = errors.New("you don't have permission to access this resource")
)
View Source
var (
	GeneralSuccess    = "Success"
	ErrGeneralMessage = errors.New("something wrong")
	ErrMessageCaptcha = errors.New("Incorrect captcha. Please try again.")
)

Functions

func AnyToString added in v1.0.24

func AnyToString(value interface{}) string

func Calculator added in v1.0.15

func Calculator(expression string) (float64, error)

func CompareBcrypt added in v1.0.31

func CompareBcrypt(dbPass, pass string) bool

func DateDiffMidnight added in v1.0.26

func DateDiffMidnight(now time.Time) time.Duration

func DateDiffMonth added in v1.0.20

func DateDiffMonth(startDate string, endDate string) (month float64, err error)

func Decrypt added in v1.0.23

func Decrypt(cipherText, secretKey string) (string, error)

Decrypt menggunakan AES-GCM dengan secret key

func Decrypt64 added in v1.0.12

func Decrypt64(encryptedString string, keyString string) (decryptedString string, err error)

func Encrypt added in v1.0.23

func Encrypt(plainText, secretKey string) (string, error)

Encrypt menggunakan AES-GCM dengan secret key

func Encrypt64 added in v1.0.12

func Encrypt64(stringToEncrypt string) (encryptedString string)

func Evaluate added in v1.0.15

func Evaluate(operators *[]string, operands *[]float64) error

func ExportToCSV added in v1.0.18

func ExportToCSV(outputFile string, headers []string, record [][]string) (err error)

func GetDataFromContext added in v1.0.25

func GetDataFromContext(ctx context.Context, key string) string

func GetStatusCode added in v1.0.9

func GetStatusCode(err error) int

func HasDuplicateIntArray added in v1.0.27

func HasDuplicateIntArray(nums []int) bool

func HashBcrypt added in v1.0.31

func HashBcrypt(pass *string)

func InArray added in v1.0.4

func InArray(str string, list []string) bool

func IsEmailDomainEqual added in v1.0.30

func IsEmailDomainEqual(companyEmail, newUserEmail string) bool

func IsEmailValid added in v1.0.16

func IsEmailValid(email string) error

func IsNumber added in v1.0.15

func IsNumber(token string) bool

func LoggerDebug

func LoggerDebug(msg interface{})

this is for logger debug level

func LoggerError

func LoggerError(err error)

this is for logger error level

func LoggerErrorCustom added in v1.0.8

func LoggerErrorCustom(message interface{})

this is for logger error level

func LoggerFatal added in v1.0.1

func LoggerFatal(msg interface{})

this is for logger fatal level

func LoggerInfo

func LoggerInfo(message interface{})

this is for logger info level

func LoggerMiddL added in v1.0.7

func LoggerMiddL(message interface{})

this is for logger info level

func LoggerSuccess

func LoggerSuccess(message interface{})

this is for logger success level

func LoggerWarning

func LoggerWarning(message interface{})

this is for logger warning level

func ObjectToString added in v1.0.13

func ObjectToString(kks interface{}) string

func OnlyOneRemove added in v1.0.32

func OnlyOneRemove(str string, remove string) string

func PadKey added in v1.0.23

func PadKey(secretKey string) []byte

PadKey memastikan kunci sesuai dengan ukuran AES

func PerformOperation added in v1.0.15

func PerformOperation(operand1, operand2 float64, operator string) (float64, error)

func RandStringBytesMaskImprSrcUnsafe added in v1.0.10

func RandStringBytesMaskImprSrcUnsafe(n int) string

func RemoveDuplicates added in v1.0.33

func RemoveDuplicates(input []int) []int

func ReverseSlice added in v1.0.34

func ReverseSlice[T any](s []T) []T

func Tokenize added in v1.0.15

func Tokenize(expression string) []string

func UcFirst added in v1.0.19

func UcFirst(str string) string

Types

type Response added in v1.0.3

type Response struct {
	StatusCode int         `json:"status_code"`
	Status     string      `json:"status_desc"`
	Msg        string      `json:"message"`
	Data       interface{} `json:"data"`
	Errors     interface{} `json:"errors"`
}

func (*Response) MappingResponseError added in v1.0.3

func (r *Response) MappingResponseError(statusCode int, message string, error interface{})

func (*Response) MappingResponseSuccess added in v1.0.3

func (r *Response) MappingResponseSuccess(message string, data interface{})

Directories

Path Synopsis
dto
Package network client negotiator @author Arditya Kekasi
Package network client negotiator @author Arditya Kekasi

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL