cast

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

README

cast

Overview

Description

Convert the base datatype of a data structure or datatype from one base type to another (i.e. [int32,int32] to [flat64,float64]). It is useful to note that maps of arrays are allowed and handle by the specification. Allowed types for toType: int64,float64,string,int32,float32,boolean.

Implementation details

The main data structure manipulation is done with relfect switch statements. But changing the base datatype is gone with the cast library used in Hugo: github.com/spf13/cast.

Compliance to Spec

Rough level of compliance

100%

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValLen int

Functions

Types

type Input

type Input struct {
	Data   interface{} `md:"data"`
	ToType string      `md:"string",allowed=["int64","float64","string","int32","float32","boolean"]`
}

func (*Input) FromMap

func (i *Input) FromMap(values map[string]interface{}) error

type Operation

type Operation struct {
	// contains filtered or unexported fields
}

func (*Operation) Eval

func (a *Operation) Eval(inputs map[string]interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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