# README
stuttgart-things/sthingsBase
module providing basic golang functions
IMPORT
go.mod
module github..
go 1.20
require (
..
github.com/stuttgart-things/sthingsBase v0.1.3
..
)
code.go
package xy
import (
..
sthingsBase "github.com/stuttgart-things/sthingsBase"
..
)
FUNCTIONS
VERIFICATION
Check For String In Slice
members := []string{"robbie", "marc", "gary"}
check := "robbie"
isIn := CheckForStringInSlice(members, check)
CONVERTING
ConvertIntegerToString
LOGGING
StdOutFileLogger
tbd!EXAMPLE USAGE:
log := sthingsBase.StdOutFileLogger(logfilePath, "2006-01-02 15:04:05", 50, 3, 28)
..
log.Info("gRPC server running on port " + serverPort)
FILESYSTEM
CreateNestedDirectoryStructure
tbd!EXAMPLE USAGE:
sthingsBase.CreateNestedDirectoryStructure("/tmp/terraform", 0777)
FILE
ReadFileToVariable
tbd!StoreVariableInFile
tbd!REGEX
GetRegexSubMatch
tbd!GetAllRegexMatches
tbd!TEMPLATING
RenderTemplateInline
INPUT:
templateData | renderOption | delimStart | delimEnd | templateVariables |
---|---|---|---|---|
string | string | string | string | map[string]interface{} |
hello {{ .name }} | "missingkey=zero" | "{{" | "}}" | vars:= map[string]interface{}{"name": "delicious",} |
OUTPUT:
yamlBytes | err |
---|---|
[]byte | error |
EXAMPLE USAGE:
...
yamlBytes, err := sthingsBase.RenderTemplateInline(
metaDataFile.template,
"missingkey=zero",
"{{",
"}}",
chartData)
if err != nil {
log.Fatal(err)
}
TASKFILE
- TAG
LICENSE
APACHE 2.0
Copyright 2023 patrick hermann.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author Information
Patrick Hermann, stuttgart-things 04/2022
License
Licensed under the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, without WARRANTIES or conditions of any kind, either express or implied.
See the License for the specific language governing permissions and limitations under the License.