datavalue

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package datavalue provides the Value type and related methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Value

type Value struct {
	Num  float64
	Str  string
	Bool bool
	// contains filtered or unexported fields
}

Value represents a value in the language.

func Bool

func Bool(b bool) Value

Bool creates a new boolean value.

func Null

func Null() Value

Null creates a new null value.

func Number

func Number(n float64) Value

Number creates a new number value.

func String

func String(s string) Value

String creates a new string value.

func (Value) AsBool

func (v Value) AsBool() (bool, error)

AsBool returns the value as a boolean.

func (Value) AsNumber

func (v Value) AsNumber() (float64, error)

AsNumber returns the value as a number.

func (Value) AsString

func (v Value) AsString() (string, error)

AsString returns the value as a string.

func (Value) DataType

func (v Value) DataType() datatype.DataType

DataType returns the data type of the value.

func (Value) ToString

func (v Value) ToString() string

ToString returns the string representation of the value.

Jump to

Keyboard shortcuts

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