utils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyStr = ""

	ObjectType      string = "object"
	ArrayType       string = "array"
	StringType      string = "string"
	IntegerType     string = "integer"
	NumberType      string = "number"
	BooleanType     string = "boolean"
	NullType        string = "null"
	UnknownType     string = "unknown"
	NumberZeroValue int    = 0
	JSONIngest      string = "JSON.INGEST"

	GET      string = "GET"
	SET      string = "SET"
	INCRBY   string = "INCRBY"
	OVERFLOW string = "OVERFLOW"
	WRAP     string = "WRAP"
	SAT      string = "SAT"
	FAIL     string = "FAIL"
	SIGNED   string = "SIGNED"
	UNSIGNED string = "UNSIGNED"
)

Variables

This section is empty.

Functions

func BoolToInt

func BoolToInt(b bool) int

func GetJSONFieldType

func GetJSONFieldType(v interface{}) string

func IsArray

func IsArray(data any) bool

func IsFloatToIntPossible

func IsFloatToIntPossible(value float64) (int, bool)

func ParseInputJSONPath

func ParseInputJSONPath(path string) (string, bool)

This method returns the path, and a boolean value telling if the path provided follows Legacy Path Syntax or JSONPath syntax. JSON knows which syntax to use depending on the first character of the path query. If the query starts with the character $, it uses JSONPath syntax. Otherwise, it defaults to the legacy path syntax. A JSONPath query can resolve to several locations in a JSON document. In this case, the JSON commands apply the operation to every possible location. This is a major improvement over legacy path queries, which only operate on the first path.

func RoundToDecimals

func RoundToDecimals[T float32 | float64](num T, decimals int) T

RoundToDecimals rounds a float64 or float32 to a specified number of decimal places.

Types

type BitFieldOp

type BitFieldOp struct {
	Kind   string
	EType  string
	EVal   int64
	Offset int64
	Value  int64
}

func ParseBitfieldOps

func ParseBitfieldOps(args []string, readOnly bool) (ops []BitFieldOp, err error)

Jump to

Keyboard shortcuts

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