hpi

package
v0.0.0-...-7b61a0e Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const HPI_TType_AddObjectToList = "add_object_to_list"
View Source
const HPI_TType_AddToList = "add_to_list"
View Source
const HPI_TType_Aes256GcmDecode = "aes256gcm_decode"
View Source
const HPI_TType_Aes256GcmEncode = "aes256gcm_encode"
View Source
const HPI_TType_Base64Decode = "base64_decode"
View Source
const HPI_TType_Base64Encode = "base64_encode"
View Source
const HPI_TType_CalculateNumber = "calculate_number"
View Source
const HPI_TType_CheckExistingField = "check_existing_field"
View Source
const HPI_TType_CheckValue = "check_value"
View Source
const HPI_TType_CompareDateTime = "compare_date_time"
View Source
const HPI_TType_CompareNumber = "compare_number"
View Source
const HPI_TType_CompareString = "compare_string"
View Source
const HPI_TType_CopyFromList = "copy_from_list"
View Source
const HPI_TType_CopyFromListToObject = "copy_from_list_to_object"
View Source
const HPI_TType_CopyObjectToSameParent = "copy_object_to_same_parent"
View Source
const HPI_TType_CopyToList = "copy_to_list"
View Source
const HPI_TType_DateFormat = "date_format"
View Source
const HPI_TType_DateToTimeStamp = "date_to_timestamp"
View Source
const HPI_TType_DecreaseNum = "decrease_num"
View Source
const HPI_TType_DeleteField = "delete_field"
View Source
const HPI_TType_DeleteRecord = "delete_record"
View Source
const HPI_TType_DmaToSsq = "dma_to_ssq"
View Source
const HPI_TType_FilterRecord = "filter_record"
View Source
const HPI_TType_FindOneRecord = "find_one_record"
View Source
const HPI_TType_FindValuesByRegExp = "find_values_by_regexp"
View Source
const HPI_TType_FixValue = "fix_value"
View Source
const HPI_TType_GenUUID = "gen_uuid"
View Source
const HPI_TType_GenUniqueId = "gen_uniqueId"
View Source
const HPI_TType_GetCurrentTime = "get_current_time"
View Source
const HPI_TType_GetCurrentTimeStamp = "get_current_timestamp"
View Source
const HPI_TType_GetKeysInMap = "get_keys_in_map"
View Source
const HPI_TType_GetValuesInMap = "get_values_in_map"
View Source
const HPI_TType_IncreaseNum = "increase_num"
View Source
const HPI_TType_JoinList = "join_list"
View Source
const HPI_TType_JsonToString = "json_to_string"
View Source
const HPI_TType_ListSize = "list_size"
View Source
const HPI_TType_MathUtil = "math_util"
View Source
const HPI_TType_MergeString = "merge_string"
View Source
const HPI_TType_ModifyString = "modify_string"
View Source
const HPI_TType_NameFormat = "name_format"
View Source
const HPI_TType_NumberFormat = "number_format"
View Source
const HPI_TType_RandomAlphabet = "random_alphabet"
View Source
const HPI_TType_RandomInteger = "random_int"
View Source
const HPI_TType_RenameFields = "rename_fields"
View Source
const HPI_TType_ReplaceString = "replace_string"
View Source
const HPI_TType_SearchValueInList = "search_value_in_list"
View Source
const HPI_TType_SortList = "sort_list"
View Source
const HPI_TType_SplitListToObject = "split_list_to_object"
View Source
const HPI_TType_SplitString = "split_string"
View Source
const HPI_TType_SplitStringArray = "split_string_array"
View Source
const HPI_TType_SsqToDma = "ssq_to_dma"
View Source
const HPI_TType_StringToJson = "string_to_json"
View Source
const HPI_TType_SumFieldsInList = "sum_fields_in_list"
View Source
const HPI_TType_TimeStampToDate = "timestamp_to_date"
View Source
const HPI_TType_ToBoolean = "to_boolean"
View Source
const HPI_TType_ToNumber = "to_number"
View Source
const HPI_TType_TrimString = "trim_string"
View Source
const HPI_TType_UpdateRecord = "update_record"
View Source
const HPI_TType_ValidateAndCopy = "validate_and_copy"

Variables

This section is empty.

Functions

func CastToMap

func CastToMap(in interface{}) (map[string]interface{}, error)

func ClearOutputDirectory

func ClearOutputDirectory(dir string) error

func CopyFile

func CopyFile(source string, target string) error

func ExitOnError

func ExitOnError(err error, message string)

func Interface2Str

func Interface2Str(o interface{}) string

func IsFileExist

func IsFileExist(file string) bool

func IsFileExists

func IsFileExists(filename string) bool

func JsonArrayFromFile

func JsonArrayFromFile(file_path string) ([]interface{}, error)

func JsonFromFile

func JsonFromFile(file_path string) (interface{}, error)

func JsonMapFromFile

func JsonMapFromFile(file_path string) (map[string]interface{}, error)

func JsonToMap

func JsonToMap(b []byte) (map[string]interface{}, error)

func ListFiles

func ListFiles(path string) []string

func MakeDirectory

func MakeDirectory(dir string) error

func ProcessTransform

func ProcessTransform(dataBus map[string]interface{}, transform map[string]interface{}) (res map[string]interface{}, err error)

ProcessTransform is function to transfrom data in dataBus by transform configuration

func ReadFile

func ReadFile(source string) ([]byte, error)

func RemoveFile

func RemoveFile(file string) error

func RemoveFolder

func RemoveFolder(file string) error

func TransformData

func TransformData(input map[string]interface{}, output map[string]interface{}, transform map[string]interface{}) (res map[string]interface{}, err error)

TransformData is function to transfrom data by transform configuration

func TransformDataWithFile

func TransformDataWithFile(input map[string]interface{}, output map[string]interface{}, transformFile string) (res map[string]interface{}, err error)

TransformDataWithFile is function to transfrom data by transform config path

func TransformWithFile

func TransformWithFile(dataBus map[string]interface{}, transformFile string) (res map[string]interface{}, err error)

Transform is function to transfrom data in dataBus by transform config path

func WriteFile

func WriteFile(filePath string, data ...string) error

func WriteJsonFile

func WriteJsonFile(path string, data interface{}) (err error)

WriteJsonFile is function to write json data to file

Types

type JsonPath

type JsonPath struct {
	Root *map[string]interface{} `structs:"root" json:"root" bson:"root"`
}

JsonPath is data model of root of path

func NewJsonPath

func NewJsonPath() *JsonPath

Create new json path

func NewJsonPathWithRoot

func NewJsonPathWithRoot(root *map[string]interface{}) (*JsonPath, error)

Create new json path

func (*JsonPath) Delete

func (c *JsonPath) Delete(path string) error

Delete is function to delete value by path

func (*JsonPath) Set

func (c *JsonPath) Set(path string, value interface{}) error

Value is function to get value by path

func (*JsonPath) String

func (c *JsonPath) String(defaultValue, path string) (str string)

Value is function to get value by path

func (*JsonPath) ToMap

func (c *JsonPath) ToMap() map[string]interface{}

ToMap is function to get root map

func (*JsonPath) Value

func (c *JsonPath) Value(path string) interface{}

Value is function to get value by path

type Transform

type Transform struct {

	// Input data
	Input interface{} `structs:"input" json:"input" bson:"input"`

	// Output data if you want to merge function
	Output interface{} `structs:"output" json:"output" bson:"output"`

	// Shared databus between transform function
	InputBus  *JsonPath `structs:"inputBus" json:"inputBus" bson:"inputBus"`
	OutputBus *JsonPath `structs:"outputBus" json:"outputBus" bson:"outputBus"`

	// Flag to ignore converting output databus to map
	IgnoreReturn bool `structs:"ignoreReturn" json:"ignoreReturn" bson:"ignoreReturn"`
}

func (*Transform) AppendToList

func (c *Transform) AppendToList(list []interface{}, value interface{}, toFirst bool) []interface{}

AppendToList is function to append data by first or last index

func (*Transform) CheckFilterRecord

func (c *Transform) CheckFilterRecord(fields []string, values []interface{}, data map[string]interface{}, isAnd bool, compareType string) (success bool)

CheckFilterRecord is function to check condition for filtering record

func (*Transform) CheckValueRecord

func (c *Transform) CheckValueRecord(obj interface{}, values []interface{}, compareType string) bool

CheckValueRecord is function to check condition for filtering record

func (*Transform) CompareDateTime

func (c *Transform) CompareDateTime(v1 interface{}, v2 interface{}, compareType string, format string, valueType string) (bool, error)

CheckValueRecord is function to check condition for filtering record

func (*Transform) CompareNumber

func (c *Transform) CompareNumber(vi interface{}, vj interface{}) int

CompareNumber is function to compare number value

func (*Transform) CompareObject

func (c *Transform) CompareObject(obji interface{}, objj interface{}, valueType string, format string) int

CompareObject is function to compare object by type

func (*Transform) CompareString

func (c *Transform) CompareString(vi interface{}, vj interface{}) int

CompareString is function to compare string value

func (*Transform) CompareTime

func (c *Transform) CompareTime(vi interface{}, vj interface{}, format string) int

CompareTime is function to compare date time

func (*Transform) ConvertValueByType

func (c *Transform) ConvertValueByType(value interface{}, strType string, defaultValue string) (interface{}, error)

ConvertValueByType is function to convert value by type

func (*Transform) DecryptWithAes256Gcm

func (c *Transform) DecryptWithAes256Gcm(encryptedText string, passcode string) (string, error)

DecryptWithAes256Gcm is function to decrypt with AES256GCM

func (*Transform) DeleteOutputData

func (c *Transform) DeleteOutputData(path string)

DeleteOutputData is function to delete output field

func (*Transform) DoConvertDmaToSsq

func (c *Transform) DoConvertDmaToSsq(in interface{}, serviceName, ssqVersion, listName string) (resultData map[string]interface{}, err error)

DoConvertDmaToSsq is function convertion logic

func (*Transform) DoConvertSsqToDma

func (c *Transform) DoConvertSsqToDma(in interface{}) (resultData map[string]interface{}, resultSuccess bool, resultMessage string, err error)

doConvertSsqToDma is function convertion logic

func (*Transform) EncryptWithAes256Gcm

func (c *Transform) EncryptWithAes256Gcm(text string, passcode string) (string, error)

EncryptWithAes256Gcm is function to encrypt with AES256GCM

func (*Transform) FindValuesByRegExp

func (c *Transform) FindValuesByRegExp(obj interface{}, strRegExp string) ([]string, error)

FindValuesByRegExp is function find values by reqular expression

func (*Transform) FormatNaming

func (c *Transform) FormatNaming(str string, format string) string

FormatNaming is function to format naming

func (*Transform) FormatNumber

func (c *Transform) FormatNumber(num float64, intDigit int64, padding string, decDigit int64, thousandSeparator string, decimalSeparator string) string

FormatNumber is function to format number and return string format

func (*Transform) GetBasicConfig

func (c *Transform) GetBasicConfig(transform interface{}) (*TransformConfig, error)

GetBasicConfig is function to get basic data of transfrom

func (*Transform) GetIndexValue

func (c *Transform) GetIndexValue(indexKey string, maxIndex int) int

GetIndexValue is function to get index value in array

func (*Transform) GetInputBus

func (c *Transform) GetInputBus() *JsonPath

GetInputBus is function to create inputBus if it is null and return it

func (*Transform) GetNameFromPath

func (c *Transform) GetNameFromPath(path string) (name string)

GetNameFromPath is function to get only name from full path

func (*Transform) GetNumberInString

func (c *Transform) GetNumberInString(obj interface{}) (float64, error)

GetNumberInString function to get number in string

func (*Transform) GetOutput

func (c *Transform) GetOutput() map[string]interface{}

GetOutput is function to convert outputBut to map data

func (*Transform) GetOutputBus

func (c *Transform) GetOutputBus() *JsonPath

GetOutputBus is function to create outbutBus if it is null and return it

func (*Transform) GetParentFromPath

func (c *Transform) GetParentFromPath(path string) (parent string)

GetParentFromPath is function to get only parent from full path

func (*Transform) HpiAddObjectToList

func (c *Transform) HpiAddObjectToList(tConfig interface{}) (output map[string]interface{}, err error)

HpiAddObjectToList is function to add object to the list at first or last record

func (*Transform) HpiAddToList

func (c *Transform) HpiAddToList(tConfig interface{}) (output map[string]interface{}, err error)

HpiAddToList is function to add value of some field to the list at first or last record

func (*Transform) HpiAes256GcmDecode

func (c *Transform) HpiAes256GcmDecode(tConfig interface{}) (output map[string]interface{}, err error)

HpiAes256GcmDecode is function to decode string to AES256-GCM

func (*Transform) HpiAes256GcmEncode

func (c *Transform) HpiAes256GcmEncode(tConfig interface{}) (output map[string]interface{}, err error)

HpiAes256GcmEncode is function to encode string to AES256-GCM

func (*Transform) HpiBase64Decode

func (c *Transform) HpiBase64Decode(tConfig interface{}) (output map[string]interface{}, err error)

HpiBase64Decode is function to decode base64 to string value

func (*Transform) HpiBase64Encode

func (c *Transform) HpiBase64Encode(tConfig interface{}) (output map[string]interface{}, err error)

HpiBase64Encode is function to encode string to base64

func (*Transform) HpiCalculateNumber

func (c *Transform) HpiCalculateNumber(tConfig interface{}) (output map[string]interface{}, err error)

HpiCalculateNumber is function to calculate number value

func (*Transform) HpiCheckExistingField

func (c *Transform) HpiCheckExistingField(tConfig interface{}) (output map[string]interface{}, err error)

HpiCheckExistingField is function to check existing field in object

func (*Transform) HpiCheckValue

func (c *Transform) HpiCheckValue(tConfig interface{}) (output map[string]interface{}, err error)

HpiCheckValue is function to check value whether it's match with config value

func (*Transform) HpiCompareDateTime

func (c *Transform) HpiCompareDateTime(tConfig interface{}) (output map[string]interface{}, err error)

HpiCompareDateTime is function to compare date and time

func (*Transform) HpiCompareNumber

func (c *Transform) HpiCompareNumber(tConfig interface{}) (output map[string]interface{}, err error)

HpiCompareNumber is function to compare number value

func (*Transform) HpiCompareString

func (c *Transform) HpiCompareString(tConfig interface{}) (output map[string]interface{}, err error)

HpiCompareString is function to compare string value

func (*Transform) HpiCopyFromList

func (c *Transform) HpiCopyFromList(tConfig interface{}) (output map[string]interface{}, err error)

HpiCopyFromList is function to copy field inside of list to target path

func (*Transform) HpiCopyFromListToObject

func (c *Transform) HpiCopyFromListToObject(tConfig interface{}) (output map[string]interface{}, err error)

HpiCopyFromListToObject is function to copy data from list to object

func (*Transform) HpiCopyObjectToSameParent

func (c *Transform) HpiCopyObjectToSameParent(tConfig interface{}) (output map[string]interface{}, err error)

HpiCopyObjectToSameParent is function to copy value in the map to same parent of output

func (*Transform) HpiCopyToList

func (c *Transform) HpiCopyToList(tConfig interface{}) (output map[string]interface{}, err error)

HpiCopyToList is function to copy value from field and put it to all records in list

func (*Transform) HpiDateFormat

func (c *Transform) HpiDateFormat(tConfig interface{}) (output map[string]interface{}, err error)

HpiGetCurrentTime is function to get current time from this system

func (*Transform) HpiDateToTimeStamp

func (c *Transform) HpiDateToTimeStamp(tConfig interface{}) (output map[string]interface{}, err error)

HpiDateToTimeStamp is function to convert date to time stamp

func (*Transform) HpiDecreaseNumber

func (c *Transform) HpiDecreaseNumber(tConfig interface{}) (output map[string]interface{}, err error)

HpiDecreaseNumber is function to decrease number

func (*Transform) HpiDeleteField

func (c *Transform) HpiDeleteField(tConfig interface{}) (output map[string]interface{}, err error)

HpiDeleteField is function to delete field form data bus

func (*Transform) HpiDeleteRecord

func (c *Transform) HpiDeleteRecord(tConfig interface{}) (output map[string]interface{}, err error)

HpiDeleteRecord is function to delete some record in list

func (*Transform) HpiDmaToSsqDataFormat

func (c *Transform) HpiDmaToSsqDataFormat(tConfig interface{}) (output map[string]interface{}, err error)

HpiDmaToSsqDataFormat is function to convert DMA response data to SSQ request data format

func (*Transform) HpiFilterRecord

func (c *Transform) HpiFilterRecord(tConfig interface{}) (output map[string]interface{}, err error)

HpiFilterRecord is function to filter some match record condition in list

func (*Transform) HpiFindOneRecord

func (c *Transform) HpiFindOneRecord(tConfig interface{}) (output map[string]interface{}, err error)

HpiFindOneRecord is function to find match one record condition in list

func (*Transform) HpiFindValuesByRegExp

func (c *Transform) HpiFindValuesByRegExp(tConfig interface{}) (output map[string]interface{}, err error)

HpiFindValuesByRegExp is function to find values by regular expression

func (*Transform) HpiFixValue

func (c *Transform) HpiFixValue(tConfig interface{}) (output map[string]interface{}, err error)

HpiFixValue is function to declare field and its value

func (*Transform) HpiGenUUID

func (c *Transform) HpiGenUUID(tConfig interface{}) (output map[string]interface{}, err error)

HpiGenUUID is function to generate uuid by num bit of string

func (*Transform) HpiGenUniqueID

func (c *Transform) HpiGenUniqueID(tConfig interface{}) (output map[string]interface{}, err error)

HpiGenUniqueID is function to generate uniqueID by num bit of string

func (*Transform) HpiGetCurrentTime

func (c *Transform) HpiGetCurrentTime(tConfig interface{}) (output map[string]interface{}, err error)

HpiGetCurrentTime is function to get current time from this system

func (*Transform) HpiGetCurrentTimeStamp

func (c *Transform) HpiGetCurrentTimeStamp(tConfig interface{}) (output map[string]interface{}, err error)

HpiGetCurrentTimeStamp is function to get current time from this system

func (*Transform) HpiGetKeysInMap

func (c *Transform) HpiGetKeysInMap(tConfig interface{}) (output map[string]interface{}, err error)

HpiGetKeys is function to list key of map value to output

func (*Transform) HpiGetValuesInMap

func (c *Transform) HpiGetValuesInMap(tConfig interface{}) (output map[string]interface{}, err error)

HpiGetValuesInMap is function to get values by key of map value to output

func (*Transform) HpiIncreaseNumber

func (c *Transform) HpiIncreaseNumber(tConfig interface{}) (output map[string]interface{}, err error)

HpiIncreaseNumber is function to increase number

func (*Transform) HpiJoinList

func (c *Transform) HpiJoinList(tConfig interface{}) (output map[string]interface{}, err error)

HpiJoinList is function to join two list by some field and return it to output list

func (*Transform) HpiJsonToString

func (c *Transform) HpiJsonToString(tConfig interface{}) (output map[string]interface{}, err error)

HpiJsonToString is function to convert json object to json string

func (*Transform) HpiListSize

func (c *Transform) HpiListSize(tConfig interface{}) (output map[string]interface{}, err error)

HpiListSize is function to count size of the list

func (*Transform) HpiMathUtil

func (c *Transform) HpiMathUtil(tConfig interface{}) (output map[string]interface{}, err error)

HpiMathUtil is function about utilities of math package

func (*Transform) HpiMergeString

func (c *Transform) HpiMergeString(tConfig interface{}) (output map[string]interface{}, err error)

HpiMergeString is function to merge field in input param to output param with combine text

func (*Transform) HpiModifyString

func (c *Transform) HpiModifyString(tConfig interface{}) (output map[string]interface{}, err error)

HpiModifyString is function to modify the string and set it back to output

func (*Transform) HpiNameFormat

func (c *Transform) HpiNameFormat(tConfig interface{}) (output map[string]interface{}, err error)

HpiNameFormat is function to format string by naming type

func (*Transform) HpiNumberFormat

func (c *Transform) HpiNumberFormat(tConfig interface{}) (output map[string]interface{}, err error)

HpiNumberFormat is function to format the number value to string format

func (*Transform) HpiRandomAlphabet

func (c *Transform) HpiRandomAlphabet(tConfig interface{}) (output map[string]interface{}, err error)

HpiRandomAlphabet is function to random alphabet for transform node

func (*Transform) HpiRandomInteger

func (c *Transform) HpiRandomInteger(tConfig interface{}) (output map[string]interface{}, err error)

HpiRandomInteger is function to random integer for transform node

func (*Transform) HpiRenameFields

func (c *Transform) HpiRenameFields(tConfig interface{}) (output map[string]interface{}, err error)

HpiRenameFields is function to rename field from input to output

func (*Transform) HpiReplaceString

func (c *Transform) HpiReplaceString(tConfig interface{}) (output map[string]interface{}, err error)

HpiReplaceString is function to replace string from old strong to new string

func (*Transform) HpiSearchValueInList

func (c *Transform) HpiSearchValueInList(tConfig interface{}) (output map[string]interface{}, err error)

HpiSearchValueInList is function to search value of each record in the list

func (*Transform) HpiSortList

func (c *Transform) HpiSortList(tConfig interface{}) (output map[string]interface{}, err error)

HpiSortList is function to sort data in the list

func (*Transform) HpiSplitListToObject

func (c *Transform) HpiSplitListToObject(tConfig interface{}) (output map[string]interface{}, err error)

HpiSplitListToObject is function to split list to object and set it to output

func (*Transform) HpiSplitString

func (c *Transform) HpiSplitString(tConfig interface{}) (output map[string]interface{}, err error)

HpiSplitString is function to split field value in input param to output param with split text

func (*Transform) HpiSplitStringArray

func (c *Transform) HpiSplitStringArray(tConfig interface{}) (output map[string]interface{}, err error)

HpiSplitStringArray is function to split field value in input param to output param with split text

func (*Transform) HpiSsqToDmaDataFormat

func (c *Transform) HpiSsqToDmaDataFormat(tConfig interface{}) (output map[string]interface{}, err error)

HpiSsqToDmaDataFormat is function to convert SSQ response data to DMA request data format

func (*Transform) HpiStringToJson

func (c *Transform) HpiStringToJson(tConfig interface{}) (output map[string]interface{}, err error)

HpiStringToJson is function to convert string to json object

func (*Transform) HpiSumFieldsInList

func (c *Transform) HpiSumFieldsInList(tConfig interface{}) (output map[string]interface{}, err error)

SumFieldsInList is function to sum value of field in list

func (*Transform) HpiTimeStampToDate

func (c *Transform) HpiTimeStampToDate(tConfig interface{}) (output map[string]interface{}, err error)

HpiTimeStampToDate is function to convert time stamp to date format

func (*Transform) HpiToBoolean

func (c *Transform) HpiToBoolean(tConfig interface{}) (output map[string]interface{}, err error)

HpiToBoolean is function to convert other type to boolean

func (*Transform) HpiToNumber

func (c *Transform) HpiToNumber(tConfig interface{}) (output map[string]interface{}, err error)

HpiToNumber is function to convert other type to number data

func (*Transform) HpiTrimString

func (c *Transform) HpiTrimString(tConfig interface{}) (output map[string]interface{}, err error)

HpiTrimString is function to remove all white space form string

func (*Transform) HpiUpdateRecord

func (c *Transform) HpiUpdateRecord(tConfig interface{}) (output map[string]interface{}, err error)

HpiCopyToList is function to copy value from field and put it to all records in list

func (*Transform) HpiValidateAndCopy

func (c *Transform) HpiValidateAndCopy(tConfig interface{}) (output map[string]interface{}, err error)

HpiValidateAndCopy is function to validate value before copy it to output

func (*Transform) IsEqual

func (c *Transform) IsEqual(v1 interface{}, v2 interface{}, compareType string) bool

IsEqual is function to check value of two fields wether it is equal

func (*Transform) JoinRecord

func (c *Transform) JoinRecord(fields1 []string, fields2 []string, data1 map[string]interface{}, data2 map[string]interface{}, isAnd bool) (data3 map[string]interface{}, success bool)

JoinRecord is function to join record by some field and condition

func (*Transform) RemoveIndexInList

func (c *Transform) RemoveIndexInList(list []interface{}, index int) []interface{}

RemoveIndexInList is function to remove index in list

func (*Transform) ReverseString

func (c *Transform) ReverseString(s string) string

ReverseString is function to reverse string value

func (*Transform) SetOutputData

func (c *Transform) SetOutputData(path string, value interface{})

SetOutputData is function to set output data by path

func (*Transform) SortList

func (c *Transform) SortList(list []interface{}, sortType string, field string, valueType string, format string) []interface{}

SortList is function to sort list

func (*Transform) SortListMap

func (c *Transform) SortListMap(list []interface{}, sortType string, field string, valueType string, format string) []interface{}

func (*Transform) SortListObject

func (c *Transform) SortListObject(list []interface{}, sortType string, valueType string, format string) []interface{}

func (*Transform) ToArrayFields

func (c *Transform) ToArrayFields(fields string) []string

ToFieldArray is function to convert fields that it's saparated by comma to array

func (*Transform) ToArrayValues

func (c *Transform) ToArrayValues(values string) (valArr []interface{})

ToArrayValues is function to convert value and separated by comma to array value

func (*Transform) ToBoolean

func (c *Transform) ToBoolean(value interface{}) bool

ToBoolean is function to convert object to boolean

func (*Transform) ToFloat64

func (c *Transform) ToFloat64(value interface{}) (float64, error)

ToDecimal is function to convert number to float64

func (*Transform) ToInt64

func (c *Transform) ToInt64(value interface{}) (int64, error)

ToInteger is function to convert number to int64

func (*Transform) ToString

func (c *Transform) ToString(value interface{}) (string, error)

ToString is function to convert object to string

func (*Transform) ToValueParam

func (c *Transform) ToValueParam(inValue interface{}) (value interface{})

ToValueParam is function to convert value from sting and $param

func (*Transform) Validate

func (c *Transform) Validate(trnsConf *TransformConfig, expectedType string, needInput bool, needOutput bool) error

Validate is function to validate transform type and input output data

func (*Transform) ValidateList

func (c *Transform) ValidateList(data interface{}) (list []interface{}, err error)

ValidateList is function to validate list

func (*Transform) ValidateListOfMap

func (c *Transform) ValidateListOfMap(data interface{}) (list []interface{}, err error)

ValidateListOfMap is function to validate list of map

func (*Transform) ValidateNullData

func (c *Transform) ValidateNullData(config *TransformConfig, checkEmpty bool) (err error)

ValidateNullData is function to validate null and empty data

func (*Transform) ValidateObjectByType

func (c *Transform) ValidateObjectByType(data interface{}, validateType string) bool

ValidateObjectByType is function to validate object by validate type

type TransformConfig

type TransformConfig struct {
	Input     []string `structs:"input" json:"input" bson:"input"`
	Output    []string `structs:"output" json:"output" bson:"output"`
	Type      string   `structs:"type" json:"type" bson:"type"`
	Split     string   `structs:"split" json:"split" bson:"split"`
	Combine   string   `structs:"combine" json:"combine" bson:"combine"`
	Compare   string   `structs:"compare" json:"compare" bson:"compare"`
	Format    string   `structs:"format" json:"format" bson:"format"`
	From      string   `structs:"from" json:"from" bson:"from"`
	To        string   `structs:"to" json:"to" bson:"to"`
	Position  string   `structs:"position" json:"position" bson:"position"`
	Num       int64    `structs:"num" json:"num" bson:"num"`
	Step      int64    `structs:"step" json:"step" bson:"step"`
	ValueType string   `structs:"valueType" json:"valueType" bson:"valueType"`
	Value     string   `structs:"value" json:"value" bson:"value"`
	Index     string   `structs:"index" json:"index" bson:"index"`
	Fields    string   `structs:"fields" json:"fields" bson:"fields"`
	Fields2   string   `structs:"fields2" json:"fields2" bson:"fields2"`
	Operator  string   `structs:"operator" json:"operator" bson:"operator"`

	RegExp string `structs:"regexp" json:"regexp" bson:"regexp"`
	Prefix string `structs:"prefix" json:"prefix" bson:"prefix"`
	Suffix string `structs:"suffix" json:"suffix" bson:"suffix"`
	Center string `structs:"center" json:"center" bson:"center"`

	// Number Format
	IntDigit          int64  `structs:"intDigit" json:"intDigit" bson:"intDigit"`
	Padding           string `structs:"padding" json:"padding" bson:"padding"`
	DecDigit          int64  `structs:"decDigit" json:"decDigit" bson:"decDigit"`
	ThousandSeparator string `structs:"thousandSeparator" json:"thousandSeparator" bson:"thousandSeparator"`
	DecimalSeparator  string `structs:"decimalSeparator" json:"decimalSeparator" bson:"decimalSeparator"`
}

TransformConfig is data model of transform configuration

type TransformConfigFile

type TransformConfigFile struct {
	File   string                 `structs:"file" json:"file" bson:"file"`
	Config map[string]interface{} `structs:"config" json:"config" bson:"config"`
}

TransformConfigFile is data of transfrom config from file

Jump to

Keyboard shortcuts

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