util

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateFileChunks

func CalculateFileChunks(r io.Reader, delimiter byte, res chan<- FileChunkCalculationResult)

CalculateFileChunks calculates all chunks of r that are delimited by delimiter. r is read in a streamed fashion. Results will be published on a res channel as they appear when reading r. Closes the result channel as soon as r is exhaustively read.

func FmtBytesHumanReadable added in v0.5.0

func FmtBytesHumanReadable(bytes float32) string

FmtBytesHumanReadable takes an amount of bytes and returns them in a human readable form up to a unit of PiB.

func FmtDurationHumanReadable added in v0.5.0

func FmtDurationHumanReadable(d time.Duration) string

FmtDurationHumanReadable takes a duration and returns it in a human readable form. This is basically equivalent to time.Duration.Round(time.Second) with the following differences:

  • durations under a minute get printed with millisecond precision
  • durations equal or above a minute get printed with second precision

func FmtOperationOutcomes added in v0.8.2

func FmtOperationOutcomes(outcome []*fm.OperationOutcome) string

func Indent added in v0.8.2

func Indent(spaces int, v string) string

func IndentExceptFirstLine added in v0.8.6

func IndentExceptFirstLine(spaces int, v string) string

Types

type DurationStatistics added in v0.5.0

type DurationStatistics struct {
	Mean, Q50, Q95, Q99, Max time.Duration
}

DurationStatistics represents statistics about measured durations. Comprises information about the mean and max as well as different percentiles (50, 95 and 99).

func CalculateDurationStatistics added in v0.5.0

func CalculateDurationStatistics(durations []float64) DurationStatistics

Calculates the DurationStatistics for a set of given durations.

type ErrorResponse added in v0.5.0

type ErrorResponse struct {
	StatusCode       int
	OperationOutcome *fm.OperationOutcome
	OtherError       string
}

ErrorResponse represents an error returned from the FHIR server.

func (*ErrorResponse) String added in v0.5.0

func (errRes *ErrorResponse) String() string

String returns the ErrorResponse in a default formatted way.

type FileChunk

type FileChunk struct {
	ChunkNumber int
	StartBytes  int64
	EndBytes    int64
}

FileChunk describes a chunk within a file with its starting position and end position in bytes. Both are given as bytes counted from the file's beginning. Also carries information about the chunk number (i.e. its order position) within the file.

type FileChunkCalculationResult

type FileChunkCalculationResult struct {
	FileChunk FileChunk
	Err       error
}

FileChunkCalculationResult represents a single result of a file chunk calculation. Carries information about a FileChunk and additional error information. A FileChunk can still hold valuable information even in the presence of an error such as the chunk number.

Jump to

Keyboard shortcuts

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