scalar

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Code below generated from scalar_gen.go.tmpl

Index

Constants

This section is empty.

Variables

View Source
var Bin = Fn(func(s S) (S, error) { s.ActualDisplay = NumberBinary; return s, nil })
View Source
var Dec = Fn(func(s S) (S, error) { s.ActualDisplay = NumberDecimal; return s, nil })
View Source
var Hex = Fn(func(s S) (S, error) { s.ActualDisplay = NumberHex; return s, nil })
View Source
var Oct = Fn(func(s S) (S, error) { s.ActualDisplay = NumberOctal; return s, nil })
View Source
var RawHex = Fn(func(s S) (S, error) {
	return rawSym(s, -1, func(b []byte) string { return fmt.Sprintf("%x", b) })
})
View Source
var RawUUID = Fn(func(s S) (S, error) {
	return rawSym(s, -1, func(b []byte) string {
		return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
	})
})
View Source
var SymBin = Fn(func(s S) (S, error) { s.SymDisplay = NumberBinary; return s, nil })
View Source
var SymDec = Fn(func(s S) (S, error) { s.SymDisplay = NumberDecimal; return s, nil })
View Source
var SymHex = Fn(func(s S) (S, error) { s.SymDisplay = NumberHex; return s, nil })
View Source
var SymOct = Fn(func(s S) (S, error) { s.SymDisplay = NumberOctal; return s, nil })
View Source
var TrimSpace = Fn(func(s S) (S, error) {
	s.Actual = strings.TrimSpace(s.ActualStr())
	return s, nil
})

Functions

This section is empty.

Types

type BoolToDescription added in v0.0.7

type BoolToDescription map[bool]string

Map Bool -> Scalar description

func (BoolToDescription) MapScalar added in v0.0.7

func (m BoolToDescription) MapScalar(s S) (S, error)

type BoolToScalar

type BoolToScalar map[bool]S

Map Bool -> Scalar

func (BoolToScalar) MapScalar

func (m BoolToScalar) MapScalar(s S) (S, error)

type BoolToSymBool

type BoolToSymBool map[bool]bool

Map Bool -> Sym Bool

func (BoolToSymBool) MapScalar

func (m BoolToSymBool) MapScalar(s S) (S, error)

type BoolToSymF

type BoolToSymF map[bool]float64

Map Bool -> Sym F

func (BoolToSymF) MapScalar

func (m BoolToSymF) MapScalar(s S) (S, error)

type BoolToSymS

type BoolToSymS map[bool]int64

Map Bool -> Sym S

func (BoolToSymS) MapScalar

func (m BoolToSymS) MapScalar(s S) (S, error)

type BoolToSymStr

type BoolToSymStr map[bool]string

Map Bool -> Sym Str

func (BoolToSymStr) MapScalar

func (m BoolToSymStr) MapScalar(s S) (S, error)

type BoolToSymU

type BoolToSymU map[bool]uint64

Map Bool -> Sym U

func (BoolToSymU) MapScalar

func (m BoolToSymU) MapScalar(s S) (S, error)

type BytesToScalar

type BytesToScalar []struct {
	Bytes  []byte
	Scalar S
}

func (BytesToScalar) MapScalar

func (m BytesToScalar) MapScalar(s S) (S, error)

type DisplayFormat

type DisplayFormat int
const (
	NumberDecimal DisplayFormat = iota
	NumberBinary
	NumberOctal
	NumberHex
)

func (DisplayFormat) FormatBase

func (df DisplayFormat) FormatBase() int

type Fn

type Fn func(S) (S, error)

func (Fn) MapScalar

func (fn Fn) MapScalar(s S) (S, error)

type Mapper

type Mapper interface {
	MapScalar(S) (S, error)
}

func Actual

func Actual(v interface{}) Mapper

func Description

func Description(v string) Mapper

func SAdd

func SAdd(n int) Mapper

func StrFToSym added in v0.0.5

func StrFToSym(base int) Mapper

func StrIntToSym added in v0.0.5

func StrIntToSym(base int) Mapper

func StrUintToSym added in v0.0.5

func StrUintToSym(base int) Mapper

func Sym

func Sym(v interface{}) Mapper

func Trim

func Trim(cutset string) Mapper

TODO: nicer api?

func UAdd

func UAdd(n int) Mapper

type S

type S struct {
	Actual        interface{} // nil, int, int64, uint64, float64, string, bool, []byte, *bit.Int, bitio.BitReaderAtSeeker,
	ActualDisplay DisplayFormat
	Sym           interface{}
	SymDisplay    DisplayFormat
	Description   string
	Unknown       bool
}

func (S) ActualBigInt added in v0.0.4

func (s S) ActualBigInt() *big.Int

ActualBigInt asserts actual value is a BigInt and returns it

func (S) ActualBitBuf

func (s S) ActualBitBuf() bitio.ReaderAtSeeker

ActualBitBuf asserts actual value is a BitBuf and returns it

func (S) ActualBool

func (s S) ActualBool() bool

ActualBool asserts actual value is a Bool and returns it

func (S) ActualF

func (s S) ActualF() float64

ActualF asserts actual value is a F and returns it

func (S) ActualS

func (s S) ActualS() int64

ActualS asserts actual value is a S and returns it

func (S) ActualStr

func (s S) ActualStr() string

ActualStr asserts actual value is a Str and returns it

func (S) ActualU

func (s S) ActualU() uint64

ActualU asserts actual value is a U and returns it

func (S) SymBigInt added in v0.0.4

func (s S) SymBigInt() *big.Int

SymBigInt asserts symbolic value is a BigInt and returns it

func (S) SymBitBuf

func (s S) SymBitBuf() bitio.ReaderAtSeeker

SymBitBuf asserts symbolic value is a BitBuf and returns it

func (S) SymBool

func (s S) SymBool() bool

SymBool asserts symbolic value is a Bool and returns it

func (S) SymF

func (s S) SymF() float64

SymF asserts symbolic value is a F and returns it

func (S) SymS

func (s S) SymS() int64

SymS asserts symbolic value is a S and returns it

func (S) SymStr

func (s S) SymStr() string

SymStr asserts symbolic value is a Str and returns it

func (S) SymU

func (s S) SymU() uint64

SymU asserts symbolic value is a U and returns it

func (S) Value

func (s S) Value() interface{}

type SRangeEntry added in v0.0.3

type SRangeEntry struct {
	Range [2]int64
	S     S
}

SRangeToScalar maps ranges to a scalar, first in range is chosen

type SRangeToScalar

type SRangeToScalar []SRangeEntry

SRangeToScalar maps sint64 ranges to a scalar, first in range is chosen

func (SRangeToScalar) MapScalar

func (rs SRangeToScalar) MapScalar(s S) (S, error)

type SToDescription added in v0.0.7

type SToDescription map[int64]string

Map S -> Scalar description

func (SToDescription) MapScalar added in v0.0.7

func (m SToDescription) MapScalar(s S) (S, error)

type SToScalar

type SToScalar map[int64]S

Map S -> Scalar

func (SToScalar) MapScalar

func (m SToScalar) MapScalar(s S) (S, error)

type SToSymBool

type SToSymBool map[int64]bool

Map S -> Sym Bool

func (SToSymBool) MapScalar

func (m SToSymBool) MapScalar(s S) (S, error)

type SToSymF

type SToSymF map[int64]float64

Map S -> Sym F

func (SToSymF) MapScalar

func (m SToSymF) MapScalar(s S) (S, error)

type SToSymS

type SToSymS map[int64]int64

Map S -> Sym S

func (SToSymS) MapScalar

func (m SToSymS) MapScalar(s S) (S, error)

type SToSymStr

type SToSymStr map[int64]string

Map S -> Sym Str

func (SToSymStr) MapScalar

func (m SToSymStr) MapScalar(s S) (S, error)

type SToSymU

type SToSymU map[int64]uint64

Map S -> Sym U

func (SToSymU) MapScalar

func (m SToSymU) MapScalar(s S) (S, error)

type StrToDescription added in v0.0.7

type StrToDescription map[string]string

Map Str -> Scalar description

func (StrToDescription) MapScalar added in v0.0.7

func (m StrToDescription) MapScalar(s S) (S, error)

type StrToScalar

type StrToScalar map[string]S

Map Str -> Scalar

func (StrToScalar) MapScalar

func (m StrToScalar) MapScalar(s S) (S, error)

type StrToSymBool

type StrToSymBool map[string]bool

Map Str -> Sym Bool

func (StrToSymBool) MapScalar

func (m StrToSymBool) MapScalar(s S) (S, error)

type StrToSymF

type StrToSymF map[string]float64

Map Str -> Sym F

func (StrToSymF) MapScalar

func (m StrToSymF) MapScalar(s S) (S, error)

type StrToSymS

type StrToSymS map[string]int64

Map Str -> Sym S

func (StrToSymS) MapScalar

func (m StrToSymS) MapScalar(s S) (S, error)

type StrToSymStr

type StrToSymStr map[string]string

Map Str -> Sym Str

func (StrToSymStr) MapScalar

func (m StrToSymStr) MapScalar(s S) (S, error)

type StrToSymU

type StrToSymU map[string]uint64

Map Str -> Sym U

func (StrToSymU) MapScalar

func (m StrToSymU) MapScalar(s S) (S, error)

type URangeEntry added in v0.0.3

type URangeEntry struct {
	Range [2]uint64
	S     S
}

type URangeToScalar

type URangeToScalar []URangeEntry

URangeToScalar maps uint64 ranges to a scalar, first in range is chosen

func (URangeToScalar) MapScalar

func (rs URangeToScalar) MapScalar(s S) (S, error)

type UToDescription added in v0.0.7

type UToDescription map[uint64]string

Map U -> Scalar description

func (UToDescription) MapScalar added in v0.0.7

func (m UToDescription) MapScalar(s S) (S, error)

type UToScalar

type UToScalar map[uint64]S

Map U -> Scalar

func (UToScalar) MapScalar

func (m UToScalar) MapScalar(s S) (S, error)

type UToSymBool

type UToSymBool map[uint64]bool

Map U -> Sym Bool

func (UToSymBool) MapScalar

func (m UToSymBool) MapScalar(s S) (S, error)

type UToSymF

type UToSymF map[uint64]float64

Map U -> Sym F

func (UToSymF) MapScalar

func (m UToSymF) MapScalar(s S) (S, error)

type UToSymS

type UToSymS map[uint64]int64

Map U -> Sym S

func (UToSymS) MapScalar

func (m UToSymS) MapScalar(s S) (S, error)

type UToSymStr

type UToSymStr map[uint64]string

Map U -> Sym Str

func (UToSymStr) MapScalar

func (m UToSymStr) MapScalar(s S) (S, error)

type UToSymU

type UToSymU map[uint64]uint64

Map U -> Sym U

func (UToSymU) MapScalar

func (m UToSymU) MapScalar(s S) (S, error)

Jump to

Keyboard shortcuts

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