types

package
v0.0.0-...-e081c89 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrDataTypeDefaulted is returned if the murex data type is unknown
	ErrDataTypeDefaulted = "unexpected or unknown murex data type"

	// ErrUnexpectedGoType is returned if the Go data type is unhandled
	ErrUnexpectedGoType = "unexpected Go type"

	// ErrCannotConvertGoType is returned if the Go data type cannot be converted
	// to the murex data type (eg there is no numeric data in a string of characters)
	ErrCannotConvertGoType = "cannot convert Go type into murex data type (eg no numeric data in a string)"
)
View Source
const (
	Any               = "@Any"
	Text              = "@Text"
	Math              = "@Math"
	Unmarshal         = "@Unmarshal"
	Marshal           = "@Marshal"
	ReadArray         = "@ReadArray"
	ReadArrayWithType = "@ReadArrayWithType"
	WriteArray        = "@WriteArray"
	ReadIndex         = "@ReadIndex"
	ReadNotIndex      = "@ReadNotIndex"
	ReadMap           = "@ReadMap"
)

These are the different supported type groups

View Source
const (
	Generic   = "*"
	Null      = "null"
	Die       = "die"
	Boolean   = "bool"
	String    = "str"
	Columns   = "columns"
	Binary    = "bin"
	CodeBlock = "block"
	Json      = "json"
	JsonLines = "jsonl"
	Number    = "num"
	Integer   = "int"
	Float     = "float"
	Path      = "path"
	Paths     = "paths"
)

These are only a list of the base types. Others can be added via builtins or during runtime. However their behavior will default to string (str).

View Source
const FalseString = "false"

FalseString is `false` boolean value

View Source
const TrueString = "true"

TrueString is `true` boolean value

Variables

View Source
var FalseByte = []byte(FalseString)

FalseByte is `false` as a []byte slice

View Source
var GroupMath = []string{
	Number,
	Integer,
	Float,
	Boolean,
}

GroupMath is an array of the data types that make up the `math` type

View Source
var GroupText = []string{
	Generic,
	String,
	`generic`,
	`string`,
}

GroupText is an array of the data types that make up the `text` type

View Source
var TrueByte = []byte(TrueString)

TrueByte is `true` as a []byte slice

Functions

func ConvertGoType

func ConvertGoType(v interface{}, dataType string) (interface{}, error)

ConvertGoType converts a Go lang variable into a murex variable

func DataTypeFromInterface

func DataTypeFromInterface(v interface{}) string

DataTypeFromInterface returns the Murex data-type expected to be associated with any specific Go data type.

func FloatToString

func FloatToString(f float64) string

FloatToString convert a Float64 (what murex numbers are stored as) into a string. Typically for outputting to Stdout/Stderr.

func IsBlock

func IsBlock(b []byte) bool

IsBlock checks if the []byte slice is a code or JSON block

func IsBlockRune

func IsBlockRune(r []rune) bool

IsBlockRune checks if the []rune slice is a code or JSON block

func IsTrue

func IsTrue(stdout []byte, exitNum int) bool

IsTrue checks if a process has returned a `true` state. This will check a few conditions as not every external process will return a non-zero exit number on a failure.

func IsTrueString

func IsTrueString(stdout string, exitNum int) bool

func MapToTable

func MapToTable(v []interface{}, callback func([]string) error) error

func Table2Map

func Table2Map(v [][]string, callback func(map[string]any) error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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