utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatJSON

func FormatJSON(input string) (result string, err error)

FormatJSON formats a JSON string

func IsJSON

func IsJSON(s string) bool

IsJSON checks if a string is valid JSON or not

func JSONSStringsAreEqual

func JSONSStringsAreEqual(input1 string, input2 string) (result bool, err error)

JSONSStringsAreEqual checks whether two JSON strings are actually equal JSON objects

func JoinContent

func JoinContent(value1 string, value2 string) string

JoinContent returns two contents joined as JSON if both are JSONs otherwise concatenates them

func JoinJSON

func JoinJSON(inputs ...string) string

JoinJSON merges two JSON strings

func UnWrapNonJSONStringIfNeeded

func UnWrapNonJSONStringIfNeeded(input string) string

UnWrapNonJSONStringIfNeeded wrapps non JSON string in NonJSONItem object

func WrapNonJSONStringIfNeeded

func WrapNonJSONStringIfNeeded(input string) (result string, err error)

WrapNonJSONStringIfNeeded wrapps non JSON string in NonJSONItem object

Types

type Cartesian

type Cartesian struct {
}

Cartesian gets all combinations of values for keys

func (Cartesian) CartesianDistribute

func (c Cartesian) CartesianDistribute(input [][]string) [][]string

CartesianDistribute getting full combinations distribution using cartesian combination algorithm - http://stackoverflow.com/a/15310051/613113

func (Cartesian) GetCombinations

func (c Cartesian) GetCombinations(inputMap map[string][]string) []map[string]string

GetCombinations returns an array of maps with all combinations built by a map with values "key1": ["1", "2"], "key2":["3", "4"] -> [{"key1":"1", "key2":"3"}, {"key1":"1", "key2":"4"}, {"key1":"2", "key2":"3"}, {"key1":"2", "key2":"4"}]

type RegexHelper

type RegexHelper struct {
}

func (RegexHelper) GetCollectionItems

func (rh RegexHelper) GetCollectionItems(input string, getRegexParts func(string) (string, string, bool)) ([]string, bool)

func (RegexHelper) GetStringPart

func (rh RegexHelper) GetStringPart(input string, pattern string, groupName string) (string, bool)

GetStringPart gets the value of the group name matching the input using the pattern

Jump to

Keyboard shortcuts

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