gutils

package module
v2.8.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 12 Imported by: 0

README

gutils: Common utilities for go

Common utilities for go

Documentation

Index

Constants

View Source
const (
	// NoPrint : Setting to no print type
	NoPrint = false

	// Print : Setting to print type
	Print = true
)
View Source
const (
	// StringType : string type symbol
	StringType = 1

	// IntType : int type symbol
	IntType = 2

	// Int8Type : int8 type symbol
	Int8Type = 3

	// Int16Type : int16 type symbol
	Int16Type = 4

	// Int32Type : int32 type symbol
	Int32Type = 5

	// Int64Type : int64 type symbol
	Int64Type = 6

	// UIntType : uint type symbol
	UIntType = 7

	// UInt8Type : uint8 type symbol
	UInt8Type = 8

	// UInt16Type : uint16 type symbol
	UInt16Type = 9

	// UInt32Type : uint32 type symbol
	UInt32Type = 10

	// UInt64Type : uint64 type symbol
	UInt64Type = 11

	// Float32Type : float32 type symbol
	Float32Type = 12

	// Float64Type : float64 type symbol
	Float64Type = 13

	// ObjectType : map[string]interface{} type symbol
	ObjectType = 14

	// ArrayType : []interface{} type symbol
	ArrayType = 15

	// ArrayObjectType : []map[string]interface{} type symbol
	ArrayObjectType = 16

	// BooleanType : bool type symbol
	BooleanType = 17
)

Variables

This section is empty.

Functions

func EchoBind

func EchoBind(c echo.Context, req interface{}, contextList []string)

EchoBind : Bind all request payload and addition data in echo context

func EchoGatewayLogger

func EchoGatewayLogger(c echo.Context, funcName string)

EchoGatewayLogger : Gateway log with physical path, function name, client IP and request time for echo library

func EchoGatewayLoggerV2

func EchoGatewayLoggerV2(c echo.Context, funcName string, reqMap map[string]interface{})

EchoGatewayLoggerV2 : Gateway log with physical path, function name, client IP, request time and request payload for echo library

func GatewayLogger

func GatewayLogger(c *gin.Context, funcName string)

GatewayLogger : Gateway log with physical path, function name, client IP and request timefor gin-gonic library

func GetRequest

func GetRequest(c *gin.Context, reqMap map[string]interface{}, getMethodVarNames []string)

GetRequest : Get payload request of all request method

func LineOABoardcastMessages

func LineOABoardcastMessages(channelAccessToken string, message []string)

func ReturnServiceError

func ReturnServiceError() []byte

ReturnServiceError : Return error response when somethong wrong about service communication

func ReturnValidationError

func ReturnValidationError() []byte

ReturnValidationError : Return error response when something wrong about validate variable

func SendResponse

func SendResponse(success bool, message *string, data interface{}) []byte

SendResponse : Standard response form in my projects

func SendResponseV2

func SendResponseV2(success bool, message *string, data interface{}, errors []string, pages *uint32) []byte

SendResponseV2 : Standard response form in my projects - add errors, pages key

func SendResponseV3

func SendResponseV3(success bool, message *string, data interface{}, errors []string, custom map[string]interface{}) []byte

SendResponseV3 : Standard response form in my projects - update can customize response key-value with map

func ServiceCommunicator

func ServiceCommunicator(dataMap map[string]interface{}, serviceName string, topicName string, data amqp.Delivery, clientRPC func([]byte, string, string, string) []byte) (map[string]interface{}, bool)

ServiceCommunicator : Service communicator function for rabbitmq

func ServiceCommunicatorV2

func ServiceCommunicatorV2(dataMap map[string]interface{}, serviceName string, topicName string, data amqp.Delivery, clientRPC func([]byte, string, string, amqp.Delivery) []byte) (map[string]interface{}, bool)

ServiceCommunicatorV2 : Service communicator with tracing function for rabbitmq

func SetResponseLogger

func SetResponseLogger(printStatus bool)

SetResponseLogger : Set logger status to print or no print in SendResponse function

func SetResponseLoggerLimit

func SetResponseLoggerLimit(limit uint32)

SetResponseLogger : Set maximum text length of log printer

func TypeValidator

func TypeValidator(varType int, dataMap map[string]interface{}, varNames []string) bool

TypeValidator : Common validator with custom type value

Types

This section is empty.

Jump to

Keyboard shortcuts

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