evalcore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package evalcore provides the hashing, context conversion and JSON helpers of the core module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHash

func BuildHash(flagName, bucketingKey string, maxPercentage uint32) uint32

BuildHash is building the hash based on the different properties of the evaluation.

func Contains

func Contains(s []string, str string) bool

Contains reports whether str is an element of s.

func ContextToMap

func ContextToMap(ctx ffcontext.Context) map[string]any

ContextToMap convert the context to a MAP to use the query on it.

func ContextToMapInto

func ContextToMapInto(dst map[string]any, ctx ffcontext.Context) map[string]any

ContextToMapInto is ContextToMap filling (and returning) the empty map dst, that the caller can reuse to avoid allocating a map for every evaluation.

func ConvertEvaluationCtxFromRequest

func ConvertEvaluationCtxFromRequest(
	targetingKey string,
	custom map[string]any,
) ffcontext.EvaluationContext

ConvertEvaluationCtxFromRequest convert the result of an unmarshal request from the API to a ffcontext.EvaluationContext.

func GetNestedFieldValue

func GetNestedFieldValue(ctx map[string]any, bucketingKey string) (any, error)

GetNestedFieldValue returns the value from a nested path in the given map. If the path does not exist or an error occurs, it returns an error.

func Hash

func Hash(s string) uint32

Hash is taking a string and convert.

func IsIntegral

func IsIntegral(val float64) bool

IsIntegral returns true if the float is an integer.

func IsJSONObject

func IsJSONObject(input string) bool

IsJSONObject checks if input is a valid JSON.

func JSONTypeExtractor

func JSONTypeExtractor(variation any) string

JSONTypeExtractor returns the JSON type name of the variation value.

func StrTrim

func StrTrim(query string) string

StrTrim returns query as a single line, for the rules-format grammar: the leading spaces of every line, the line ends (LF or CRLF) and the blank lines are removed. Two lines are joined with a space unless the text already has a separator there (the previous line ends with a space) or the join cannot merge two tokens (after an opening bracket, before a closing bracket or a comma). A line break inside a quoted value becomes exactly one space (a space that already ends the line is reused). A query on one line only loses its leading spaces.

It must not be used on a JsonLogic query: that is JSON, which ignores whitespace between tokens and rejects a newline inside a string, so it is read as written.

Types

This section is empty.

Jump to

Keyboard shortcuts

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