utils

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Unlicense Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ignore = make(map[int32]string)

Ignore is an empty map that can be used in place of alternate values for the marshaller

View Source
var None = make(map[string]int32)

None is an empty map that can be used in place of alternate values for the unmarshaller

Functions

func HasValue added in v1.3.8

func HasValue[TEnum ~int32](value TEnum) bool

HasValue returns true if the value provided represents an actual enum value, or false if the value is equivalent to what would be produced by calling NoValue for that enum

func MarshalString added in v1.1.1

func MarshalString[TIn ~int32, TMap ~int32, TAlt ~int32](data TIn, mapping map[TMap]string, alternates map[TAlt]string, quote bool) string

MarshalString converts an enum value to a string based on the _value mapping and a possible alternative mapping

func NoValue added in v1.3.6

func NoValue[TEnum ~int32]() TEnum

NoValue returns the equivalent of no-value for one of the common financial enums. This function can be used when the user wants to deactivate a filter that relies on an enum message type

func ScanValue

func ScanValue[TMap ~int32, TAlt ~int32, TOut ~int32](value interface{}, mapping map[string]TMap,
	alternates map[string]TAlt, data *TOut) error

ScanValue is intended to be used by functions that want to implement the Scanner interface for converting SQL values to enums

func UnmarshalString

func UnmarshalString[TMap ~int32, TAlt ~int32, TOut ~int32](value string, mapping map[string]TMap,
	alternates map[string]TAlt, data *TOut) error

UnmarshalString unmarshals a value from a string into an enum value

func UnmarshalValue

func UnmarshalValue[TMap ~int32, TAlt ~int32, TOut ~int32](raw []byte, mapping map[string]TMap,
	alternates map[string]TAlt, data *TOut) error

UnmarshalValue converts JSON to a protobuf enum value

Types

This section is empty.

Jump to

Keyboard shortcuts

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