types

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package types defines the FHIRPath type system.

Index

Constants

View Source
const TypeNameDecimal = "Decimal"

TypeNameDecimal is the FHIRPath type name for decimal values.

Variables

View Source
var EmptyCollection = Collection{}

EmptyCollection is a shared empty collection to avoid allocations.

View Source
var FalseCollection = Collection{falseBoolean}

FalseCollection is a cached collection containing false.

View Source
var TrueCollection = Collection{trueBoolean}

TrueCollection is a cached collection containing true.

Functions

func PutCollection

func PutCollection(c *Collection)

PutCollection returns a Collection to the pool for reuse. The collection is reset to length 0.

Types

type Boolean

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

Boolean represents a FHIRPath boolean value.

func GetBoolean

func GetBoolean(b bool) Boolean

GetBoolean returns a cached Boolean value.

func NewBoolean

func NewBoolean(v bool) Boolean

NewBoolean creates a new Boolean value.

func (Boolean) Bool

func (b Boolean) Bool() bool

Bool returns the underlying boolean value.

func (Boolean) Equal

func (b Boolean) Equal(other Value) bool

Equal returns true if other is a Boolean with the same value.

func (Boolean) Equivalent

func (b Boolean) Equivalent(other Value) bool

Equivalent is the same as Equal for booleans.

func (Boolean) IsEmpty

func (b Boolean) IsEmpty() bool

IsEmpty returns false for boolean values.

func (Boolean) Not

func (b Boolean) Not() Boolean

Not returns the logical negation.

func (Boolean) String

func (b Boolean) String() string

String returns "true" or "false".

func (Boolean) Type

func (b Boolean) Type() string

Type returns "Boolean".

type Collection

type Collection []Value

Collection is an ordered sequence of FHIRPath values. It is the fundamental return type for all FHIRPath expressions.

func GetCollection

func GetCollection() *Collection

GetCollection returns a Collection from the pool. The returned collection has length 0 but may have capacity > 0.

func JSONToCollection

func JSONToCollection(data []byte) (Collection, error)

JSONToCollection converts JSON bytes to a Collection.

func NewCollectionWithCap

func NewCollectionWithCap(capacity int) Collection

NewCollectionWithCap creates a new Collection with the specified capacity. Use this when you know the expected size to avoid reallocations.

func SingletonCollection

func SingletonCollection(v Value) Collection

SingletonCollection creates a collection with a single value. This is a common operation that benefits from optimization.

func (Collection) AllFalse

func (c Collection) AllFalse() bool

AllFalse returns true if all items are boolean false.

func (Collection) AllTrue

func (c Collection) AllTrue() bool

AllTrue returns true if all items are boolean true.

func (Collection) AnyFalse

func (c Collection) AnyFalse() bool

AnyFalse returns true if any item is boolean false.

func (Collection) AnyTrue

func (c Collection) AnyTrue() bool

AnyTrue returns true if any item is boolean true.

func (Collection) Combine

func (c Collection) Combine(other Collection) Collection

Combine returns a new collection that combines c and other. Unlike Union, duplicates are preserved.

func (Collection) Contains

func (c Collection) Contains(v Value) bool

Contains returns true if the collection contains a value equal to v.

func (Collection) Count

func (c Collection) Count() int

Count returns the number of elements in the collection.

func (Collection) Distinct

func (c Collection) Distinct() Collection

Distinct returns a new collection with duplicate values removed. Preserves the order of first occurrence.

func (Collection) Empty

func (c Collection) Empty() bool

Empty returns true if the collection has no elements.

func (Collection) Exclude

func (c Collection) Exclude(other Collection) Collection

Exclude returns elements in c that are not in other.

func (Collection) First

func (c Collection) First() (Value, bool)

First returns the first element and true, or nil and false if empty.

func (Collection) Intersect

func (c Collection) Intersect(other Collection) Collection

Intersect returns elements that are in both collections.

func (Collection) IsDistinct

func (c Collection) IsDistinct() bool

IsDistinct returns true if all elements in the collection are unique.

func (Collection) Last

func (c Collection) Last() (Value, bool)

Last returns the last element and true, or nil and false if empty.

func (Collection) Single

func (c Collection) Single() (Value, error)

Single returns the single element if the collection has exactly one element. Returns an error if empty or has more than one element.

func (Collection) Skip

func (c Collection) Skip(n int) Collection

Skip returns a collection with the first n elements removed.

func (Collection) String

func (c Collection) String() string

String returns a string representation of the collection.

func (Collection) Tail

func (c Collection) Tail() Collection

Tail returns all elements except the first.

func (Collection) Take

func (c Collection) Take(n int) Collection

Take returns a collection with only the first n elements.

func (Collection) ToBoolean

func (c Collection) ToBoolean() (bool, error)

ToBoolean converts singleton collection to boolean. Returns error if not a singleton or not a boolean value.

func (Collection) Union

func (c Collection) Union(other Collection) Collection

Union returns a new collection that is the union of c and other. Duplicates are removed.

type Comparable

type Comparable interface {
	Value
	// Compare returns -1 if less than, 0 if equal, 1 if greater than.
	// Returns error if types are incompatible.
	Compare(other Value) (int, error)
}

Comparable is implemented by types that support ordering.

type Date

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

Date represents a FHIRPath date value. Supports partial dates: year, year-month, year-month-day.

func NewDate

func NewDate(s string) (Date, error)

NewDate creates a Date from a string.

func NewDateFromTime

func NewDateFromTime(t time.Time) Date

NewDateFromTime creates a Date from a time.Time.

func (Date) AddDuration

func (d Date) AddDuration(value int, unit string) Date

AddDuration adds a duration (as Quantity with temporal unit) to the date. Supported units: year(s), month(s), week(s), day(s)

func (Date) Compare

func (d Date) Compare(other Value) (int, error)

Compare compares two dates. Returns -1, 0, or 1. Implements the Comparable interface. Returns empty (error) if precisions differ and comparison is ambiguous.

func (Date) Day

func (d Date) Day() int

Day returns the day component (0 if not specified).

func (Date) Equal

func (d Date) Equal(other Value) bool

Equal checks equality with another value.

func (Date) Equivalent

func (d Date) Equivalent(other Value) bool

Equivalent checks equivalence with another value.

func (Date) IsEmpty

func (d Date) IsEmpty() bool

IsEmpty returns false for Date.

func (Date) Month

func (d Date) Month() int

Month returns the month component (0 if not specified).

func (Date) Precision

func (d Date) Precision() DatePrecision

Precision returns the date precision.

func (Date) String

func (d Date) String() string

String returns the string representation.

func (Date) SubtractDuration

func (d Date) SubtractDuration(value int, unit string) Date

SubtractDuration subtracts a duration from the date.

func (Date) ToTime

func (d Date) ToTime() time.Time

ToTime converts to time.Time (uses defaults for missing components).

func (Date) Type

func (d Date) Type() string

Type returns the type name.

func (Date) Year

func (d Date) Year() int

Year returns the year component.

type DatePrecision

type DatePrecision int

DatePrecision indicates the precision of a date.

const (
	YearPrecision DatePrecision = iota
	MonthPrecision
	DayPrecision
)

type DateTime

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

DateTime represents a FHIRPath datetime value.

func NewDateTime

func NewDateTime(s string) (DateTime, error)

NewDateTime creates a DateTime from a string.

func NewDateTimeFromTime

func NewDateTimeFromTime(t time.Time) DateTime

NewDateTimeFromTime creates a DateTime from time.Time.

func (DateTime) AddDuration

func (dt DateTime) AddDuration(value int, unit string) DateTime

AddDuration adds a duration (as Quantity with temporal unit) to the datetime. Supported units: year(s), month(s), week(s), day(s), hour(s), minute(s), second(s), millisecond(s)

func (DateTime) Compare

func (dt DateTime) Compare(other Value) (int, error)

Compare compares two datetimes. Returns -1, 0, or 1. Implements the Comparable interface. Returns error if precisions differ and comparison is ambiguous.

func (DateTime) Day

func (dt DateTime) Day() int

func (DateTime) Equal

func (dt DateTime) Equal(other Value) bool

Equal checks equality with another value.

func (DateTime) Equivalent

func (dt DateTime) Equivalent(other Value) bool

Equivalent checks equivalence with another value.

func (DateTime) HasTZ added in v1.3.0

func (dt DateTime) HasTZ() bool

HasTZ returns whether the datetime has an explicit timezone.

func (DateTime) Hour

func (dt DateTime) Hour() int

func (DateTime) IsEmpty

func (dt DateTime) IsEmpty() bool

IsEmpty returns false for DateTime.

func (DateTime) Millisecond

func (dt DateTime) Millisecond() int

func (DateTime) Minute

func (dt DateTime) Minute() int

func (DateTime) Month

func (dt DateTime) Month() int

func (DateTime) Precision added in v1.3.0

func (dt DateTime) Precision() DateTimePrecision

Precision returns the datetime precision.

func (DateTime) Second

func (dt DateTime) Second() int

func (DateTime) String

func (dt DateTime) String() string

String returns the string representation.

func (DateTime) SubtractDuration

func (dt DateTime) SubtractDuration(value int, unit string) DateTime

SubtractDuration subtracts a duration from the datetime.

func (DateTime) TZOffset added in v1.3.0

func (dt DateTime) TZOffset() int

TZOffset returns the timezone offset in minutes.

func (DateTime) ToTime

func (dt DateTime) ToTime() time.Time

ToTime converts to time.Time.

func (DateTime) Type

func (dt DateTime) Type() string

Type returns the type name.

func (DateTime) Year

func (dt DateTime) Year() int

Accessors

type DateTimePrecision

type DateTimePrecision int

DateTimePrecision indicates the precision of a datetime.

const (
	DTYearPrecision DateTimePrecision = iota
	DTMonthPrecision
	DTDayPrecision
	DTHourPrecision
	DTMinutePrecision
	DTSecondPrecision
	DTMillisPrecision
)

type Decimal

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

Decimal represents a FHIRPath decimal value with arbitrary precision.

func MustDecimal

func MustDecimal(s string) Decimal

MustDecimal creates a new Decimal, panicking on error.

func NewDecimal

func NewDecimal(s string) (Decimal, error)

NewDecimal creates a new Decimal from a string.

func NewDecimalFromFloat

func NewDecimalFromFloat(v float64) Decimal

NewDecimalFromFloat creates a new Decimal from a float64.

func NewDecimalFromInt

func NewDecimalFromInt(v int64) Decimal

NewDecimalFromInt creates a new Decimal from an int64.

func (Decimal) Abs

func (d Decimal) Abs() Decimal

Abs returns the absolute value.

func (Decimal) Add

func (d Decimal) Add(other Decimal) Decimal

Add returns the sum of two decimals.

func (Decimal) Ceiling

func (d Decimal) Ceiling() Integer

Ceiling returns the smallest integer >= d.

func (Decimal) Compare

func (d Decimal) Compare(other Value) (int, error)

Compare compares two numeric values.

func (Decimal) Divide

func (d Decimal) Divide(other Decimal) (Decimal, error)

Divide returns the result of division.

func (Decimal) Equal

func (d Decimal) Equal(other Value) bool

Equal returns true if other is numerically equal.

func (Decimal) Equivalent

func (d Decimal) Equivalent(other Value) bool

Equivalent is the same as Equal for decimals.

func (Decimal) Exp

func (d Decimal) Exp() Decimal

Exp returns e^d.

func (Decimal) Floor

func (d Decimal) Floor() Integer

Floor returns the largest integer <= d.

func (Decimal) ImplicitPrecision added in v1.4.0

func (d Decimal) ImplicitPrecision() int

ImplicitPrecision returns the number of decimal places in this value, inferred from the original string representation. For example, "1.0" has precision 1, "1.00" has precision 2, and "42" has precision 0. Returns 0 for computed values with no original string.

func (Decimal) IsEmpty

func (d Decimal) IsEmpty() bool

IsEmpty returns false for decimal values.

func (Decimal) IsInteger

func (d Decimal) IsInteger() bool

IsInteger returns true if the decimal has no fractional part.

func (Decimal) Ln

func (d Decimal) Ln() (Decimal, error)

Ln returns the natural logarithm.

func (Decimal) Log

func (d Decimal) Log(base Decimal) (Decimal, error)

Log returns the logarithm with the given base.

func (Decimal) Multiply

func (d Decimal) Multiply(other Decimal) Decimal

Multiply returns the product of two decimals.

func (Decimal) Negate

func (d Decimal) Negate() Decimal

Negate returns the negation of the decimal.

func (Decimal) Power

func (d Decimal) Power(exp Decimal) Decimal

Power returns d raised to the given power.

func (Decimal) Round

func (d Decimal) Round(precision int32) Decimal

Round rounds to the given precision.

func (Decimal) Sqrt

func (d Decimal) Sqrt() (Decimal, error)

Sqrt returns the square root.

func (Decimal) String

func (d Decimal) String() string

String returns the decimal string representation. For values created from string parsing, preserves the original representation (e.g., "1.0" stays "1.0"). For computed values, uses the default shopspring representation.

func (Decimal) Subtract

func (d Decimal) Subtract(other Decimal) Decimal

Subtract returns the difference of two decimals.

func (Decimal) ToDecimal

func (d Decimal) ToDecimal() Decimal

ToDecimal returns itself (implements Numeric interface).

func (Decimal) ToInteger

func (d Decimal) ToInteger() (Integer, bool)

ToInteger converts to Integer if it's a whole number.

func (Decimal) Truncate

func (d Decimal) Truncate() Integer

Truncate returns the integer part.

func (Decimal) Type

func (d Decimal) Type() string

Type returns "Decimal".

func (Decimal) Value

func (d Decimal) Value() decimal.Decimal

Value returns the underlying decimal.Decimal value.

type Integer

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

Integer represents a FHIRPath integer value.

func GetInteger

func GetInteger(n int64) Integer

GetInteger returns a cached Integer for values in range [-128, 127]. For other values, creates a new Integer.

func NewInteger

func NewInteger(v int64) Integer

NewInteger creates a new Integer value.

func (Integer) Abs

func (i Integer) Abs() Integer

Abs returns the absolute value.

func (Integer) Add

func (i Integer) Add(other Integer) Integer

Add returns the sum of two integers.

func (Integer) Compare

func (i Integer) Compare(other Value) (int, error)

Compare compares two numeric values.

func (Integer) Div

func (i Integer) Div(other Integer) (Integer, error)

Div returns the integer division result.

func (Integer) Divide

func (i Integer) Divide(other Integer) (Decimal, error)

Divide returns the result of division as a Decimal.

func (Integer) Equal

func (i Integer) Equal(other Value) bool

Equal returns true if other is an Integer with the same value, or a Decimal with an equivalent integer value.

func (Integer) Equivalent

func (i Integer) Equivalent(other Value) bool

Equivalent is the same as Equal for integers.

func (Integer) IsEmpty

func (i Integer) IsEmpty() bool

IsEmpty returns false for integer values.

func (Integer) Mod

func (i Integer) Mod(other Integer) (Integer, error)

Mod returns the modulo result.

func (Integer) Multiply

func (i Integer) Multiply(other Integer) Integer

Multiply returns the product of two integers.

func (Integer) Negate

func (i Integer) Negate() Integer

Negate returns the negation of the integer.

func (Integer) Power

func (i Integer) Power(exp Integer) Decimal

Power returns the integer raised to the given power.

func (Integer) Sqrt

func (i Integer) Sqrt() (Decimal, error)

Sqrt returns the square root as a Decimal.

func (Integer) String

func (i Integer) String() string

String returns the decimal string representation.

func (Integer) Subtract

func (i Integer) Subtract(other Integer) Integer

Subtract returns the difference of two integers.

func (Integer) ToDecimal

func (i Integer) ToDecimal() Decimal

ToDecimal converts the integer to a Decimal.

func (Integer) Type

func (i Integer) Type() string

Type returns "Integer".

func (Integer) Value

func (i Integer) Value() int64

Value returns the underlying int64 value.

type Numeric

type Numeric interface {
	Value
	// ToDecimal converts the numeric to a Decimal.
	ToDecimal() Decimal
}

Numeric is implemented by numeric types (Integer, Decimal).

type ObjectValue

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

ObjectValue represents a FHIR resource or complex type as a JSON object.

func NewObjectValue

func NewObjectValue(data []byte) *ObjectValue

NewObjectValue creates a new ObjectValue from JSON bytes.

func NewObjectValueWithType added in v1.3.1

func NewObjectValueWithType(data []byte, typeName string) *ObjectValue

NewObjectValueWithType creates a new ObjectValue with an explicit FHIR type. Used when the type is known from polymorphic field resolution (e.g., valueQuantity → "Quantity").

func (*ObjectValue) Children

func (o *ObjectValue) Children() Collection

Children returns a collection of all child values.

func (*ObjectValue) Data

func (o *ObjectValue) Data() []byte

Data returns the raw JSON data.

func (*ObjectValue) Equal

func (o *ObjectValue) Equal(other Value) bool

Equal returns true if the JSON data is identical.

func (*ObjectValue) Equivalent

func (o *ObjectValue) Equivalent(other Value) bool

Equivalent is the same as Equal for objects.

func (*ObjectValue) Get

func (o *ObjectValue) Get(field string) (Value, bool)

Get retrieves a field value, caching the result.

func (*ObjectValue) GetCollection

func (o *ObjectValue) GetCollection(field string) Collection

GetCollection retrieves a field as a Collection. If the field is an array, returns all elements. If the field is a single value, returns a singleton collection.

func (*ObjectValue) GetCollectionWithType added in v1.3.0

func (o *ObjectValue) GetCollectionWithType(field, fhirType string) Collection

GetCollectionWithType retrieves a field as a Collection, using the FHIR type hint to properly parse string values as Date, DateTime, Time, etc.

func (*ObjectValue) IsEmpty

func (o *ObjectValue) IsEmpty() bool

IsEmpty returns false for object values.

func (*ObjectValue) Keys

func (o *ObjectValue) Keys() []string

Keys returns all field names in the object.

func (*ObjectValue) String

func (o *ObjectValue) String() string

String returns the JSON representation.

func (*ObjectValue) ToQuantity

func (o *ObjectValue) ToQuantity() (Quantity, bool)

ToQuantity attempts to convert an ObjectValue to a Quantity. This is used when the object represents a FHIR Quantity type (with fields like "value", "unit", "code", "system"). Returns the Quantity and true if successful, or zero Quantity and false if not.

func (*ObjectValue) Type

func (o *ObjectValue) Type() string

Type returns the FHIR type of this object. Checks explicit type (from polymorphic resolution), then resourceType, then infers from structure.

type Quantity

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

Quantity represents a FHIRPath quantity value with a numeric value and unit.

func NewQuantity

func NewQuantity(s string) (Quantity, error)

NewQuantity creates a Quantity from a string.

func NewQuantityFromDecimal

func NewQuantityFromDecimal(value decimal.Decimal, unit string) Quantity

NewQuantityFromDecimal creates a Quantity from a decimal value and unit.

func (Quantity) Add

func (q Quantity) Add(other Quantity) (Quantity, error)

Add adds two quantities.

func (Quantity) Compare

func (q Quantity) Compare(other Value) (int, error)

Compare compares two quantities. Returns -1, 0, or 1 if units are compatible, or error if not. Uses UCUM normalization to compare quantities with different but compatible units. Implements the Comparable interface.

func (Quantity) Divide

func (q Quantity) Divide(divisor decimal.Decimal) (Quantity, error)

Divide divides the quantity by a number.

func (Quantity) Equal

func (q Quantity) Equal(other Value) bool

Equal checks equality with another value. For quantities with different units, uses UCUM normalization per FHIRPath spec.

func (Quantity) Equivalent

func (q Quantity) Equivalent(other Value) bool

Equivalent checks equivalence with another value. For quantities, this uses UCUM normalization to compare values with different units. Per FHIRPath spec: quantities are equivalent if their canonical normalized forms are equal.

func (Quantity) IsEmpty

func (q Quantity) IsEmpty() bool

IsEmpty returns false for Quantity.

func (Quantity) Multiply

func (q Quantity) Multiply(factor decimal.Decimal) Quantity

Multiply multiplies the quantity by a number.

func (Quantity) Normalize

func (q Quantity) Normalize() ucum.NormalizedQuantity

Normalize returns the UCUM-normalized form of this quantity.

func (Quantity) String

func (q Quantity) String() string

String returns the string representation.

func (Quantity) Subtract

func (q Quantity) Subtract(other Quantity) (Quantity, error)

Subtract subtracts two quantities.

func (Quantity) Type

func (q Quantity) Type() string

Type returns the type name.

func (Quantity) Unit

func (q Quantity) Unit() string

Unit returns the unit string.

func (Quantity) Value

func (q Quantity) Value() decimal.Decimal

Value returns the numeric value.

type String

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

String represents a FHIRPath string value.

func NewString

func NewString(v string) String

NewString creates a new String value.

func NewStringWithFHIRType added in v1.3.1

func NewStringWithFHIRType(v, fhirType string) String

NewStringWithFHIRType creates a new String value with an explicit FHIR type. Used for URI subtypes (id, oid, url, uuid, code, etc.) to preserve type identity so that ofType() can discriminate between them.

func (String) Compare

func (s String) Compare(other Value) (int, error)

Compare compares two strings lexicographically.

func (String) Contains

func (s String) Contains(substr string) bool

Contains returns true if the string contains the substring.

func (String) EndsWith

func (s String) EndsWith(suffix string) bool

EndsWith returns true if the string ends with the suffix.

func (String) Equal

func (s String) Equal(other Value) bool

Equal returns true if other is a String with the same value.

func (String) Equivalent

func (s String) Equivalent(other Value) bool

Equivalent compares strings case-insensitively with normalized whitespace.

func (String) IndexOf

func (s String) IndexOf(substr string) int

IndexOf returns the index of the first occurrence of substr, or -1.

func (String) IsEmpty

func (s String) IsEmpty() bool

IsEmpty returns true if the string is empty.

func (String) Length

func (s String) Length() int

Length returns the number of characters.

func (String) Lower

func (s String) Lower() String

Lower returns a new String with all characters lowercase.

func (String) Replace

func (s String) Replace(old, replacement string) String

Replace returns a new String with all occurrences of old replaced by replacement.

func (String) StartsWith

func (s String) StartsWith(prefix string) bool

StartsWith returns true if the string starts with the prefix.

func (String) String

func (s String) String() string

String returns the string value.

func (String) Substring

func (s String) Substring(start, length int) String

Substring returns a substring starting at start with the given length.

func (String) ToChars

func (s String) ToChars() Collection

ToChars returns a collection of single-character strings.

func (String) Type

func (s String) Type() string

Type returns the FHIR type if set (e.g., "Oid", "Url"), otherwise "String".

func (String) Upper

func (s String) Upper() String

Upper returns a new String with all characters uppercase.

func (String) Value

func (s String) Value() string

Value returns the underlying string value.

type Time

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

Time represents a FHIRPath time value.

func NewTime

func NewTime(s string) (Time, error)

NewTime creates a Time from a string.

func NewTimeFromGoTime

func NewTimeFromGoTime(t gotime.Time) Time

NewTimeFromGoTime creates a Time from time.Time.

func (Time) Compare

func (t Time) Compare(other Value) (int, error)

Compare compares two times. Returns -1, 0, or 1. Implements the Comparable interface. Returns error if precisions differ and comparison is ambiguous.

func (Time) Equal

func (t Time) Equal(other Value) bool

Equal checks equality with another value.

func (Time) Equivalent

func (t Time) Equivalent(other Value) bool

Equivalent checks equivalence with another value.

func (Time) Hour

func (t Time) Hour() int

Accessors

func (Time) IsEmpty

func (t Time) IsEmpty() bool

IsEmpty returns false for Time.

func (Time) Millisecond

func (t Time) Millisecond() int

func (Time) Minute

func (t Time) Minute() int

func (Time) Precision added in v1.3.0

func (t Time) Precision() TimePrecision

Precision returns the time precision.

func (Time) Second

func (t Time) Second() int

func (Time) String

func (t Time) String() string

String returns the string representation.

func (Time) Type

func (t Time) Type() string

Type returns the type name.

type TimePrecision

type TimePrecision int

TimePrecision indicates the precision of a time.

const (
	HourPrecision TimePrecision = iota
	MinutePrecision
	SecondPrecision
	MillisPrecision
)

type TypeError

type TypeError struct {
	Expected  string
	Actual    string
	Operation string
}

TypeError represents a type mismatch error.

func NewTypeError

func NewTypeError(expected, actual, operation string) *TypeError

NewTypeError creates a new TypeError.

func (*TypeError) Error

func (e *TypeError) Error() string

Error implements the error interface.

type Value

type Value interface {
	// Type returns the FHIRPath type name.
	Type() string

	// Equal compares exact equality (= operator).
	Equal(other Value) bool

	// Equivalent compares equivalence (~ operator).
	// For strings: case-insensitive, ignores leading/trailing whitespace.
	Equivalent(other Value) bool

	// String returns a string representation of the value.
	String() string

	// IsEmpty indicates if this value represents empty.
	IsEmpty() bool
}

Value is the base interface for all FHIRPath values.

Jump to

Keyboard shortcuts

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