helpers

package
v0.0.0-...-29610b7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache(key string, data interface{}, meta interface{}) (err error)

func ConverSliceToString

func ConverSliceToString(slice []string, delimiter string) string

ConvertSliceToString ...

func ConvertStringToTime

func ConvertStringToTime(ts *string) time.Time

ConvertStringToTime ...

func ConvertTimeToString

func ConvertTimeToString(t time.Time) *string

ConvertTimeToString ...

func ESAggregate

func ESAggregate(aggs interface{}) *domain.MetaAggregations

ESAggregate ...

func GetAuthenticatedUser

func GetAuthenticatedUser(c echo.Context) *domain.JwtCustomClaims

GetAuthenticatedUser ...

func GetCache

func GetCache(c echo.Context) (memcached string)

func to get cache redis

func GetCurrentURI

func GetCurrentURI(c echo.Context) string

GetCurrentURI ...

func GetESTotalCount

func GetESTotalCount(mapResp map[string]interface{}) float64

func GetInBind

func GetInBind(binds *[]interface{}, arr []string) string

func GetMetaDataImage

func GetMetaDataImage(link string) (meta domain.DetailMetaDataImage, err error)

func GetObjectFromString

func GetObjectFromString(str string, obj interface{}) error

GetObjectFromString ...

func GetRequestParams

func GetRequestParams(c echo.Context) domain.Request

GetRequestParams ...

func GetRoleInfo

func GetRoleInfo(r domain.Role) domain.RoleInfo

GetRoleInfo ...

func GetStatusCode

func GetStatusCode(err error) int

GetStatusCode ...

func GetStringFromObject

func GetStringFromObject(obj interface{}) string

GetStringFromObject ...

func GetUnitInfo

func GetUnitInfo(u domain.Unit) domain.UnitInfo

GetUnitInfo ...

func GoogleTranslateText

func GoogleTranslateText(text, sourceLang, targetLang string) (string, error)

GoogleTranslateText function performs the actual translation using an google translation API.

func InArray

func InArray(needle interface{}, haystack interface{}) (exists bool, index int)

func IsAdminOPD

func IsAdminOPD(au *domain.JwtCustomClaims) bool

func IsCompletedDocumentArchive

func IsCompletedDocumentArchive(body *domain.DocumentArchiveRequest) bool

func IsDisallowed

func IsDisallowed(input string, disallowedKeywords []string) bool

func IsInvitationTokenValid

func IsInvitationTokenValid(regInvitation domain.RegistrationInvitation, token string) error

func IsSuperAdmin

func IsSuperAdmin(au *domain.JwtCustomClaims) bool

func IsValidMailAddress

func IsValidMailAddress(address string) (string, bool)

func MakeExcerpt

func MakeExcerpt(str string, forExcerptLength int) string

func MakeSlug

func MakeSlug(title string, newsID int64) string

MakeSlug ...

func MapLog

func MapLog(c echo.Context) *_goLog.LoggerData

Mapping log value use golog package

func MapUserInfo

func MapUserInfo(u domain.User) *domain.UserInfo

MapUserInfo ...

func MapValue

func MapValue(arrMap []interface{}, key string) (value float64)

func Paginate

func Paginate(c echo.Context, data interface{}, total int64, params domain.Request) *domain.ResultsData

Paginate ...

func ParseESDate

func ParseESDate(strDateTime string) time.Time

func ParseESPointerDate

func ParseESPointerDate(strDateTime string) *time.Time

func RedisCache

func RedisCache() *redis.Client

func to set connection of redis

func RegexCustomReplaceString

func RegexCustomReplaceString(c echo.Context, str string, repl string) string

func RegexKeywordReplaceString

func RegexKeywordReplaceString(c echo.Context, str string, repl string) string

func RegexReplaceSlug

func RegexReplaceSlug(str string) string

Sanity slug text with standard regex rules

func RegexReplaceString

func RegexReplaceString(c echo.Context, str string, repl string) string

func ReplaceBodyParams

func ReplaceBodyParams(body string, params []string) string

func SendEmail

func SendEmail(to string, template domain.Template, params []string) (err error)

func SetCache

func SetCache(key string, value interface{}, ttl time.Duration) error

func to set cache redis

func SetPointerInt64

func SetPointerInt64(val int64) *int64

SetPointerInt64 ...

func SetPointerString

func SetPointerString(val string) *string

SetPointerString ...

func SetPropLiveNews

func SetPropLiveNews(newsRequest *domain.StoreNewsRequest)

SetPropLiveNews ...

func SlugGenerator

func SlugGenerator(str string, identifier int64) string

Generate Slug

func Substr

func Substr(s string, n int) string

Types

type RangeLastWeek

type RangeLastWeek struct {
	DayOfLastWeek string
	Today         string
}

RangeLastWeek represent today and the day last of last week

func GetRangeLastWeek

func GetRangeLastWeek() RangeLastWeek

GetRangeLastWeek for get date within a week range ...

type ResponseError

type ResponseError struct {
	Message string `json:"message"`
}

ResponseError represent the response error struct

Jump to

Keyboard shortcuts

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