bloodlab-common

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: Apache-2.0

README

bloodlab-common

Enums and constants used in multiple libraries and services

Install

go get github.com/blutspende/bloodlab-common

Encoding

github.com/blutspende/bloodlab-common/encoding

Enums

Contains enum definitions used throughout bloodlab.

List of encodings. Can be used with this library's encoding utility functions directly, or with other message processing libraries such as github.com/blutspende/go-astm.

Functions

Contains utility functions for character encoding.

func ConvertFromEncodingToUtf8(input []byte, encoding encoding.Encoding) (output string, err error)
func ConvertFromUtf8ToEncoding(input string, encoding encoding.Encoding) (output []byte, err error)
func ConvertArrayFromUtf8ToEncoding(input []string, encoding encoding.Encoding) (output [][]byte, err error) 

Timezone

github.com/blutspende/bloodlab-common/timezone

Enums

List of timezones. Can be used for time.LoadLocation locations.

Functions

Contains utility functions for timezones.

func GetLocation(timezone TimeZone) (*time.Location, error)

MessageType

github.com/blutspende/bloodlab-common/messagetype List of message types. Used in drivers to identify and process messages.

MessageStatus

github.com/blutspende/bloodlab-common/messagsestatus List of message statuses. Used in drivers to store and read states of messages.

Utils

github.com/blutspende/bloodlab-common/utils Various utility functions used throughout bloodlab.

Slices

Contains utility functions for slices.

func ConvertBytes2Dto1D(twoDim [][]byte) ([]byte, error)
func ConvertBytes1Dto2D(oneDim []byte) [][]byte
func JoinEnumsAsString[T ~string](enumList []T, separator string) string
func Partition(totalLength int, partitionLength int, consumer func(low int, high int) error) error

Types

Contains type conversion utility functions. Converting between null, pointer and normal representations of string, UUID and time types.

func StringPointerToString(value *string) string
func StringPointerToStringWithDefault(value *string, defaultValue string) string
func NullStringToString(value sql.NullString) string
func NullStringToStringPointer(value sql.NullString) *string
func NullUUIDToUUIDPointer(value uuid.NullUUID) *uuid.UUID
func NullTimeToTimePointer(value sql.NullTime) *time.Time
func TimePointerToNullTime(value *time.Time) sql.NullTime

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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