Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stuttgart-things/sthingsbase
module providing basic golang functions
https://github.com/stuttgart-things/sthingsbase
converting filesystem go-template golang regex stuttgart-things
Last synced: 2 days ago
JSON representation
module providing basic golang functions
- Host: GitHub
- URL: https://github.com/stuttgart-things/sthingsbase
- Owner: stuttgart-things
- Created: 2023-04-04T04:26:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-09T13:16:58.000Z (3 months ago)
- Last Synced: 2024-08-09T14:46:39.287Z (3 months ago)
- Topics: converting, filesystem, go-template, golang, regex, stuttgart-things
- Language: Go
- Homepage:
- Size: 68.4 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stuttgart-things/sthingsBase
module providing basic golang functions## IMPORT
go.mod
```go
module github..
go 1.20require (
..
github.com/stuttgart-things/sthingsBase v0.1.3
..
)
```code.go
```go
package xyimport (
..
sthingsBase "github.com/stuttgart-things/sthingsBase"
..
)
```## FUNCTIONS
### VERIFICATION
Check For String In Slice
```go
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 athttp://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
```bash
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](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.