Help us shape the future of Go! Take the 2026 Go Developer Survey

internal

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddParamInt

func AddParamInt(m map[string]any, key string, value int, targetType definition.ParamType) error

AddParamInt: Insert a int into map[string]any as targetType

func AddParamString

func AddParamString(m map[string]any, key string, value string, targetType definition.ParamType) error

AddParamString: Insert a string into map[string]any as targetType

func DisableInlining added in v0.2.1

func DisableInlining() int

func JsonMarshal

func JsonMarshal(v any) (*json.RawMessage, error)

JsonMarshal: Convert interface{} to *json.RawMessage

func JsonUnmarshal

func JsonUnmarshal(data []byte, v any) error

JsonUnmarshal: Unmarshal json string and treat number as json.Number

func ParseJsonPath

func ParseJsonPath(input *json.RawMessage, path string) (*json.RawMessage, error)

func ParseJsonPathList

func ParseJsonPathList(input *json.RawMessage, path string, bObjAsList bool) ([]*json.RawMessage, error)

ParseJsonPathList: Parse JsonPath and try to return the result as a list

func ParseJsonPathStr

func ParseJsonPathStr(input *json.RawMessage, path string) (string, error)

ParseJsonPathStr: Parse JsonPath and try to convert result to single string

Types

type SyncMap added in v0.2.0

type SyncMap[T any] struct {
	sync.Map
}

SyncMap[T]: Generics type of wrapper of sync.Map

func (*SyncMap[T]) LoadOrCreate added in v0.2.0

func (m *SyncMap[T]) LoadOrCreate(key string, fnCreate func() (any, error), nilVal T) (T, error)

LoadOrCreate: Load an object of type T, and create a new one if it does not exist in the sync.map. @param: key: Key of object in the map @param: fnCreate: Function to create an object, normally a closure @param: nilVal: Nil value if fnCreate failed. Generics type does not support return nil as T @return: Actual object of type T loaded or created @return: Error

Directories

Path Synopsis
Package server Cloud Bench Checker API
Package server Cloud Bench Checker API

Jump to

Keyboard shortcuts

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