utils

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DATETIME_FORMAT_LAYOUT = "2006-01-02 15:04:05 +07:00"
View Source
const DATETIME_FORMAT_LAYOUT_GMT = "2006-01-02 15:04:05 GMT"
View Source
const DATETIME_PARSE_LAYOUT = time.RFC3339

const DATETIME_PARSE_LAYOUT = "2006-01-02T15:04:05Z07" const DATETIME_PARSE_LAYOUT = "2006-01-02T15:04:05"

View Source
const DATETIME_PARSE_LAYOUT_GWT = time.RFC3339

const DATETIME_PARSE_LAYOUT_GWT = "2006-01-02 15:04:05 +07:00"

Variables

This section is empty.

Functions

func ClientPathEntities

func ClientPathEntities(ri stereotypes.ApiRestInteface) string

func ClientPathEntityId

func ClientPathEntityId(ri stereotypes.ApiRestInteface) string

func ConvertoGMTToRFC3339

func ConvertoGMTToRFC3339(time string) string

convert 2019-05-16 19:31:44 GMT+06:00 to 2019-05-16T19:31:44Z+06:00

func CtxParamAsUint64

func CtxParamAsUint64(
	paramType ParamType, ctx *gin.Context, paramName string, requered bool,
) (
	value uint64, err error,
)

func EntityIdPath

func EntityIdPath(i stereotypes.ApiRestInteface) string

func EntityPath

func EntityPath(i stereotypes.ApiRestInteface) string

func GetParam

func GetParam(c *gin.Context, key string) (string, bool)

func HeaderParam

func HeaderParam(
	ctx *gin.Context, pathParamName string, requered bool,
) (
	string, error,
)

func IsBlankString

func IsBlankString(string string) bool

func IsEmptyString

func IsEmptyString(string string) bool

func IsValidMpan

func IsValidMpan(mpan string) (bool, fault.TypedError)

func IsValidMsisdn

func IsValidMsisdn(msisdn string) (
	bool,
	fault.TypedError,
)

method check valid format msisdn if msisdn is valid then return true and err nil if msisdn is invalid return false and error struct

func IsWhiteSpaceChar

func IsWhiteSpaceChar(char int32) bool

func Launch

func Launch(app stereotypes.Application)

func ParseTime

func ParseTime(paramValue string) (time.Time, error)

func PathParam

func PathParam(
	ctx *gin.Context, paramName string, requered bool,
) (
	value string, err error,
)

func PathParamAsString

func PathParamAsString(
	ctx *gin.Context, pathParamName string, requered bool,
) (
	string, error,
)

func PathParamAsTime

func PathParamAsTime(
	ctx *gin.Context, paramName string, requered bool,
) (
	time.Time, bool, error,
)

func PathParamAsUint64

func PathParamAsUint64(
	ctx *gin.Context, paramName string, requered bool,
) (
	value uint64, err error,
)

func QueryParam

func QueryParam(
	ctx *gin.Context, paramName string, requered bool,
) (
	value string, err error,
)

func QueryParamAsTime

func QueryParamAsTime(
	ctx *gin.Context, paramName string, requered bool,
) (
	time.Time, bool, error,
)

func QueryParamAsUnint64

func QueryParamAsUnint64(
	ctx *gin.Context, paramName string, requered bool,
) (
	value uint64, err error,
)

func ReadLog

func ReadLog(file string) (str string, err error)

func StringIsBlank

func StringIsBlank(val string) bool

func StringIsEmpty

func StringIsEmpty(val string) bool

contract

func StringIsNotBlank

func StringIsNotBlank(val string) bool

func StringIsNotEmpty

func StringIsNotEmpty(val string) bool

contract

func ToString

func ToString(value interface{}) string

Types

type Bool

type Bool struct {
	// contains filtered or unexported fields
}

func (*Bool) Get

func (this *Bool) Get() bool

func (*Bool) IsSet

func (this *Bool) IsSet() bool

func (*Bool) Set

func (this *Bool) Set(v bool)

func (*Bool) SetTrue

func (this *Bool) SetTrue()

type MDC

type MDC struct {
	// contains filtered or unexported fields
}

Mapped diagnostics context

func NewMDC

func NewMDC() *MDC

func (*MDC) Put

func (this *MDC) Put(ctx *gin.Context)

func (*MDC) Ψ

func (this *MDC) Ψ(key, value string)

type Optional

type Optional interface {
	IsSet() bool
}

type ParamType

type ParamType string
const (
	PATH_PARAM   ParamType = "PATH_PARAM"
	QUERY_PARAM  ParamType = "QUERY_PARAM"
	HEADER_PARAM ParamType = "HEADER_PARAM"
)

Directories

Path Synopsis
third

Jump to

Keyboard shortcuts

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