tukutil

package module
v1.3.14 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: GPL-3.0 Imports: 17 Imported by: 9

README

tukutil

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerName = ""
	SeedRoot   = "1.2.40.0.13.1.1.3542466645."
	IdSeed     = getIdIncrementSeed(5)
	CodeSystem = make(map[string]string)
)

Functions

func ArrayContains

func ArrayContains(strs []string, str string) (int, bool)

func ContainsError

func ContainsError(message string) bool

containsError checks to see if the supplied message contains one of the two error tags

func CreateLog

func CreateLog(log_Folder string) *os.File

CreateLog checks if the log folder exists and creates it if not. It then checks for a subfolder for the current year i.e. 2022 and creates it if it does not exist. It then checks for a log file with a name equal to the current day and month and extension .log i.e. 0905.log. If it exists log output is appended to the existing file otherwise a new log file is created.

func DT_ANSIC

func DT_ANSIC() string

func DT_Date

func DT_Date() string

func DT_Day

func DT_Day() string

func DT_EPOCH

func DT_EPOCH() string

func DT_Hour

func DT_Hour() string

func DT_Kitchen

func DT_Kitchen() string

func DT_MM_dd

func DT_MM_dd() string

func DT_MilliSec

func DT_MilliSec() int

func DT_Min

func DT_Min() string

func DT_Month

func DT_Month() string

func DT_SQL

func DT_SQL() string

func DT_SQL_Future_Year

func DT_SQL_Future_Year() string

func DT_Sec

func DT_Sec() string

func DT_Stamp

func DT_Stamp() string

func DT_Time

func DT_Time() string

func DT_Unix

func DT_Unix() string

func DT_Year

func DT_Year() string

func DT_Zulu

func DT_Zulu() string

func DT_Zulu_Future

func DT_Zulu_Future(future int64) string

func DT_Zulu_Future_Year

func DT_Zulu_Future_Year() string

func DT_yyyyMMddhhmmSSsss

func DT_yyyyMMddhhmmSSsss() string

func DT_yyyy_MM_dd

func DT_yyyy_MM_dd() string

func DT_yyyy_MM_dd_hh

func DT_yyyy_MM_dd_hh() string

func DT_yyyy_MM_dd_hh_mm

func DT_yyyy_MM_dd_hh_mm() string

func DT_yyyy_MM_dd_hh_mm_SS

func DT_yyyy_MM_dd_hh_mm_SS() string

func DT_yyyy_MM_dd_hh_mm_SS_sss

func DT_yyyy_MM_dd_hh_mm_SS_sss() string

func GetCodeSystemVal

func GetCodeSystemVal(key string) string

GetCodeSystemVal takes a string input (key) and returns from the codesystem the string value corresponding to the input (key)

func GetDocumentReturnList

func GetDocumentReturnList(message string) string

getDocumentReturnList extracts the document return list from the SOAP response message

func GetDuration

func GetDuration(dur time.Duration) string

GetDuration takes 2 times as string inputs in RFC3339 format (yyyy-MM-ddThh:mm:ssZ) and returns the duration in days, hours and mins in a 'pretty format' eg '2 Days 0 Hrs 52 Mins' between the provided times as a string

Example : GetDuration("2022-09-04T13:15:20Z", "2022-09-14T16:20:01Z") returns `10 Days 3 Hrs 4 Mins`

func GetDurationSince

func GetDurationSince(stime string) string

GetDurationSince takes a time as string input in RFC3339 format (yyyy-MM-ddThh:mm:ssZ) and returns the duration in days, hours and mins in a 'pretty format' eg '2 Days 0 Hrs 52 Mins' between the provided time and time.Now() as a string

func GetErrorMessage

func GetErrorMessage(message string) string

getErrorMessage returns the error message within the SOAP response or returns a generic error message

func GetFileBytes

func GetFileBytes(f string) ([]byte, error)

func GetFolderFiles

func GetFolderFiles(folder string) ([]fs.DirEntry, error)

GetFolderFiles takes a string input of the complete folder path and returns a fs.DirEntry

func GetFutueDaysDate

func GetFutueDaysDate(startDate time.Time, days int) time.Time

func GetFutureDate

func GetFutureDate(startDate time.Time, years int, months int, days int, hours int, mins int) time.Time

func GetGlypicon

func GetGlypicon(tasktype string) string

func GetHTMLWidgetFiles

func GetHTMLWidgetFiles(basepath string) ([]string, error)

func GetIdIncrementSeed

func GetIdIncrementSeed(len int) int

func GetIntFromString

func GetIntFromString(input string) int

GetIntFromString takes a string input with an integer value and returns an int of that value. If the input is not numeric, 0 is returned

func GetMilliseconds

func GetMilliseconds() int

func GetServiceUrl

func GetServiceUrl(port int, scheme, host, url string) string

func GetStringFromInt

func GetStringFromInt(i int) string

GetStringFromInt takes a int input and returns a string of that value.

func GetTimeFromString

func GetTimeFromString(timestr string) time.Time

func GetXMLNodeList

func GetXMLNodeList(message string, node string) string

GetXMLNodeList takes an xml message as input and returns the xml node list as a string for the node input value provide

func GetXMLNodeVal

func GetXMLNodeVal(message string, node string) string

func GetXdwConfigFiles

func GetXdwConfigFiles(basepath string) (map[string][]byte, error)

func GetXmlReturnNode

func GetXmlReturnNode(message string) string

func IsAfterNow

func IsAfterNow(inTime string) bool

IsAfterNow takes a time as a string input in RFC3339 format (yyyy-MM-ddThh:mm:ssZ) and returns true if the input time is after time.Now() and false if input time is before time.Now()

func IsBrokerExpression

func IsBrokerExpression(exp string) bool

func LoadCodeSystemFile

func LoadCodeSystemFile(codesystemFile string) error

LoadCodeSystemFile loads the `codesystem.json` file from the `configs` folder

func Loadjsonfile

func Loadjsonfile(jfp string) *json.Decoder

func Log

func Log(i interface{})

Log takes any struc as input and logs out the struc as a json string

func Minus

func Minus(n1 int, n2 int) string

func MonitorApp

func MonitorApp()

func New30mfutureyearzulu

func New30mfutureyearzulu() string

func NewUuid

func NewUuid() string

NewUuid returns a random UUID as a string

func Newdatetime

func Newdatetime() string

func Newid

func Newid() string

returns unique id in format '1.2.40.0.13.1.1.3542466645.20211021090059143.32643' idroot constant - 1.2.40.0.13.1.1.3542466645. + datetime - 20211021090059143. + 5 digit seed - 32643 The seed is incremented after each call to newid().

func Newyearfuturezulu

func Newyearfuturezulu() string

func Newzulu

func Newzulu() string

func NotEmpty

func NotEmpty(params []string) bool

func OHT_FutureDate

func OHT_FutureDate(startdate time.Time, htDate string) time.Time

OHT_FutureDate takes a 'start date' and a period in the future as a string containing an OASIS Human Task api function eg. day(x) returns x days in the future from the `start date`. Valid periods are min(x),hour(x),day(x),month(x) and year(x)

func OHT_ShouldEscalate

func OHT_ShouldEscalate(startdate time.Time, htDate string) bool

func PrettyAuthorInstitution

func PrettyAuthorInstitution(institution string) string

PrettyAuthorInstitution takes a string input (XDS Author.Institution format) and returns a string with just the Institution name

func PrettyAuthorPerson

func PrettyAuthorPerson(author string) string

PrettyAuthorPerson takes a string input (XDS Author.Person format) and returns a string with the person last and first names

func PrettyPrintDuration

func PrettyPrintDuration(duration time.Duration) string

func PrettyTime

func PrettyTime(time string) string

PrettyTime fist splits the input based on sep =`.`, it takes index 0 of the split and replaces any T with a space then removes any trailing Z. It then splits the resulting string on sep = `+` returning index 0 of the split

func Pretty_Time_Now

func Pretty_Time_Now() string

Pretty_Time_Now returns a pretty version of the current time for location Europe/London (strips everything after the `.` in Tuk_Time)

func ReturnDecoded

func ReturnDecoded(s string) string

func ReturnEncoded

func ReturnEncoded(s string) string

func SetCodeSystem

func SetCodeSystem(cs map[string]string)

SetCodeSystem takes a map input and sets the codesystem map with the input

func SetDebugMode added in v1.3.12

func SetDebugMode(debug bool)

func SimpleDateTime

func SimpleDateTime() string

func SplitExpression

func SplitExpression(exp string) string

func SplitFhirOid

func SplitFhirOid(oid string) string

func SplitXDWKey

func SplitXDWKey(xdwkey string) (string, string)

SplitXDWKey takes a string input (xdwkey) and returns the pathway and nhs id for the xdw

func Substr

func Substr(input string, start int, length int) string

Substr takes a string input and returns the rune (Substring) defined by the start and length in th start and length input values

func TemplateFuncMap

func TemplateFuncMap() template.FuncMap

TemplateFuncMap returns a functionMap of ttutils for use in templates

func Time_Now

func Time_Now() string

Time_Now returns the current time for location Europe/London.

func Tuk_Day

func Tuk_Day() string

TUK_Day returns the current day as a 2 digit string

func Tuk_Hour

func Tuk_Hour() string

TUK_Hour returns the current hour as a 2 digit string

func Tuk_MilliSec

func Tuk_MilliSec() int

TUK_MilliSec returns the current milliseconds as a 3 digit int

func Tuk_Min

func Tuk_Min() string

TUK_Min returns the current minute as a 2 digit string

func Tuk_Month

func Tuk_Month() string

TUK_Month returns the current month as a 2 digit string

func Tuk_Sec

func Tuk_Sec() string

TUK_Sec returns the current second as a 2 digit string

func Tuk_Year

func Tuk_Year() string

TUK_Year returns the current year as a 4 digit string

func UploadFile

func UploadFile(w http.ResponseWriter, r *http.Request)

func VALUE_LIKE

func VALUE_LIKE(val string) string

func WriteFileToTempFolder

func WriteFileToTempFolder(data []byte, filename string) error

func WriteResponseHeaders

func WriteResponseHeaders(fn http.HandlerFunc, secure bool) http.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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