Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertBytesToGo(b []byte, ptr interface{}) error
- func ConvertGoToBytes(data interface{}) ([]byte, error)
- func ConvertGrpcStructToInterface(data *structpb.Value) interface{}
- func ConvertGrpcStructToMap(data map[string]*structpb.Value) map[string]interface{}
- func ConvertGrpcToGo(data *structpb.Value, ptr interface{}) error
- func ConvertInterfaceToGrpcStruct(data interface{}) *structpb.Value
- func ConvertMapMapToGrpcStruct(data map[string]map[string]int) *structpb.Struct
- func ConvertMapToGrpcStruct(data map[string]interface{}) *structpb.Struct
- func CreateValidationErrorDetails(errorCode codes.Code, errorMessage string, errors map[string]string) error
- func CreateValidationErrorDetailsV2(errorCode codes.Code, errorMessage string, detailsPairs ...string) error
- func GetFieldName(fieldType reflect.StructField) (string, bool)
- func IsValidUUID(uuid string) bool
- func ModuleConnected(moduleName string) string
- func ParseParameters(queryRaw string) (instanceUUID string, moduleName string, error error)
- func ResolveMetadataIdentity(key string, md metadata.MD) (int, error)
- func ResolveMetadataIdentityV2(key string, md metadata.MD) (string, error)
- func Validate(value interface{}) error
- func ValidateV2(value interface{}) error
- func WrapError(err error) error
- type GrpcValueMarshaler
- type GrpcValueUnmarshaler
Constants ¶
View Source
const ( ErrorHeader = "X-MP-ERROR" ErrorsHeader = "X-MP-ERRORS" ExpectFileHeader = "X-EXPECT-FILE" // ===== ERRORS ===== ServiceError = "Service is not available now, please try later" ValidationError = "Validation errors" Required = "Required" // ===== DATE ===== FullDateFormat = "2006-01-02T15:04:05.999-07:00" // ===== GRPC ===== ProxyMethodNameHeader = "proxy_method_name" MethodDefaultGroup = "api" ApplicationIdHeader = "x-application-identity" UserIdHeader = "x-user-identity" DeviceIdHeader = "x-device-identity" ServiceIdHeader = "x-service-identity" DomainIdHeader = "x-domain-identity" SystemIdHeader = "x-system-identity" InstanceIdHeader = "x-instance-identity" ApplicationTokenHeader = "X-APPLICATION-TOKEN" UserTokenHeader = "X-USER-TOKEN" DeviceTokenHeader = "X-DEVICE-TOKEN" HeaderNotSpecifiedValue = "not_specified" )
View Source
const ( ErrorConnection = "ERROR_CONNECTION" ConfigError = "ERROR_CONFIG" ConfigSendConfigWhenConnected = "CONFIG:SEND_CONFIG_WHEN_CONNECTED" ConfigSendConfigChanged = "CONFIG:SEND_CONFIG_CHANGED" ConfigSendConfigOnRequest = "CONFIG:SEND_CONFIG_ON_REQUEST" ConfigSendRoutesWhenConnected = "CONFIG:SEND_ROUTES_WHEN_CONNECTED" ConfigSendRoutesChanged = "CONFIG:SEND_ROUTES_CHANGED" ConfigSendRoutesOnRequest = "CONFIG:SEND_ROUTES_ON_REQUEST" ConfigLogRotation = "CONFIG:LOG_ROTATION" ConfigRestart = "CONFIG:MODULE_RESTART" ModuleReady = "MODULE:READY" ModuleSendRequirements = "MODULE:SEND_REQUIREMENTS" ModuleUpdateRoutes = "MODULE:UPDATE_ROUTES" ModuleSendConfigSchema = "MODULE:SEND_CONFIG_SCHEMA" ModuleConnectionSuffix = "MODULE_CONNECTED" ModuleNameGetParamKey = "module_name" InstanceUuidGetParamKey = "instance_uuid" WsOkResponse = "ok" )
Variables ¶
View Source
var ( // ===== ENV ===== EnvProfileName = os.Getenv("APP_PROFILE") EnvConfigPath = os.Getenv("APP_CONFIG_PATH") EnvMigrationPath = os.Getenv("APP_MIGRATION_PATH") DEV = strings.ToLower(os.Getenv("APP_MODE")) == "dev" LOG_LEVEL = os.Getenv("LOG_LEVEL") )
View Source
var (
UserTokenHeaderLC = strings.ToLower(UserTokenHeader)
)
Functions ¶
func ConvertBytesToGo ¶
func ConvertGoToBytes ¶
func ConvertGrpcStructToInterface ¶
func ConvertGrpcStructToInterface(data *structpb.Value) interface{}
func ConvertGrpcStructToMap ¶
func ConvertGrpcToGo ¶
func ConvertGrpcToGo(data *structpb.Value, ptr interface{}) error
func ConvertInterfaceToGrpcStruct ¶
func ConvertInterfaceToGrpcStruct(data interface{}) *structpb.Value
func ConvertMapToGrpcStruct ¶
func ConvertMapToGrpcStruct(data map[string]interface{}) *structpb.Struct
func GetFieldName ¶
func GetFieldName(fieldType reflect.StructField) (string, bool)
func IsValidUUID ¶
func ModuleConnected ¶
func ParseParameters ¶
func ResolveMetadataIdentity ¶
func ValidateV2 ¶
func ValidateV2(value interface{}) error
Types ¶
type GrpcValueMarshaler ¶
type GrpcValueMarshaler interface {
ToGrpcValue() *structpb.Value
}
type GrpcValueUnmarshaler ¶
Click to show internal directories.
Click to hide internal directories.