utils

package
v0.0.0-...-838d5f2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ETagToVersionId

func ETagToVersionId(etag string) (string, error)

Types

type Date

type Date struct {
	Value     time.Time
	Precision DatePrecision
}

Date represents a date in a search query. FHIR search params may define dates to varying levels of precision, and the amount of precision affects the behavior of the query. Date's value should only be interpreted in the context of the Precision supplied.

func MustParseDate

func MustParseDate(dateStr string) (out *Date)

func ParseDate

func ParseDate(dateStr string) (*Date, error)

ParseDate parses a FHIR date string (roughly ISO 8601) into a Date object, maintaining the value and the precision supplied.

func (*Date) RangeHighExcl

func (d *Date) RangeHighExcl() time.Time

RangeHighExcl represents the high end of a date range to match against. As the name suggests, the high end of the range is exclusive.

func (*Date) RangeLowIncl

func (d *Date) RangeLowIncl() time.Time

RangeLowIncl represents the low end of a date range to match against. As the name suggests, the low end of the range is inclusive.

func (*Date) String

func (d *Date) String() string

String returns a string representation of the date, honoring the supplied precision.

type DatePrecision

type DatePrecision int

DatePrecision is an enum representing the precision of a date.

const (
	Year DatePrecision = iota
	Month
	Day
	Minute
	Second
	Millisecond
)

Constant values for the DatePrecision enum.

type Number

type Number struct {
	Value     *big.Rat
	Precision int
}

Number represents a number in a search query. FHIR search params may define numbers to varying levels of precision, and the amount of precision affects the behavior of the query. Number's value should only be interpreted in the context of the Precision supplied. The Precision indicates the number of decimal places in the precision.

func ParseNumber

func ParseNumber(numStr string) *Number

ParseNumber parses a numeric string into a Number object, maintaining the value and precision supplied.

func (*Number) RangeHighExcl

func (n *Number) RangeHighExcl() *big.Rat

RangeHighExcl represents the high end of a range to match against. As the name suggests, the high end of the range is exclusive.

func (*Number) RangeLowIncl

func (n *Number) RangeLowIncl() *big.Rat

RangeLowIncl represents the low end of a range to match against. As the name suggests, the low end of the range is inclusive.

func (*Number) String

func (n *Number) String() string

String returns a string representation of the number, honoring the supplied precision.

Jump to

Keyboard shortcuts

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