utils

package
v0.0.0-...-97f136a Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateConditionExpressionFunc = CreateConditionExpression

Functions

func ChangeTableNameForSpanner

func ChangeTableNameForSpanner(tableName string) string

ChangeTableNameForSpanner - ReplaceAll the hyphens (-) with underscore for given table name https://cloud.google.com/spanner/docs/data-definition-language#naming_conventions

func ConvertDynamoTypeToSpannerType

func ConvertDynamoTypeToSpannerType(dynamoType string) string

Convert DynamoDB data types to equivalent Spanner types Only used by initialization code to create tables

func CreateConditionExpression

func CreateConditionExpression(condtionExpression string, expressionAttr map[string]interface{}) (*models.Eval, error)

CreateConditionExpression - create evelute condition from condition

func EvaluateExpression

func EvaluateExpression(expression *models.Eval) (bool, error)

EvaluateExpression - evalute expression

func GetFieldNameFromConditionalExpression

func GetFieldNameFromConditionalExpression(conditionalExpression string) string

GetFieldNameFromConditionalExpression returns the field name from conditional expression

func GetStringInBetween

func GetStringInBetween(str string, start string, end string) (result string)

GetStringInBetween Returns empty string if no start string found

func ParseBeginsWith

func ParseBeginsWith(rangeExpression string) (string, string, string)

ParseBeginsWith ..

func ParseListRemoveTarget

func ParseListRemoveTarget(target string) (string, int)

parseListRemoveTarget parses a list attribute target and its index from the action value. It returns the attribute name and index. Example: listAttr[2]

func ParseNestedJSON

func ParseNestedJSON(value interface{}) interface{}

func RemoveDuplicatesByteSlice

func RemoveDuplicatesByteSlice(input [][]byte) [][]byte

RemoveDuplicatesByteSlice removes duplicates from a [][]byte

func RemoveDuplicatesFloat

func RemoveDuplicatesFloat(input []float64) []float64

RemoveDuplicatesFloat removes duplicates from a []float64

func RemoveDuplicatesString

func RemoveDuplicatesString(input []string) []string

RemoveDuplicatesString removes duplicates from a []string

func RemoveListElement

func RemoveListElement(list []interface{}, idx int) []interface{}

removeListElement removes an element from a list at the specified index. If the index is invalid, it returns the original list.

func TrimSingleQuotes

func TrimSingleQuotes(s string) string

func UpdateFieldByPath

func UpdateFieldByPath(data map[string]interface{}, path string, newValue interface{}) bool

UpdateFieldByPath navigates the nested JSON structure to update the desired field.

Types

This section is empty.

Jump to

Keyboard shortcuts

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