Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zeiss/go-transform
https://github.com/zeiss/go-transform
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zeiss/go-transform
- Owner: ZEISS
- Created: 2024-05-15T18:36:42.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-05-20T05:12:57.000Z (6 months ago)
- Last Synced: 2024-05-23T04:28:08.479Z (6 months ago)
- Language: Go
- Size: 604 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Transform
[![Test & Build](https://github.com/zeiss/go-transform/actions/workflows/main.yml/badge.svg)](https://github.com/zeiss/go-transform/actions/workflows/main.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/zeiss/go-transform.svg)](https://pkg.go.dev/github.com/zeiss/go-transform)
[![Go Report Card](https://goreportcard.com/badge/github.com/zeiss/go-transform)](https://goreportcard.com/report/github.com/zeiss/go-transform)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Taylor Swift](https://img.shields.io/badge/secured%20by-taylor%20swift-brightgreen.svg)](https://twitter.com/SwiftOnSecurity)Transform is a Go library that provides a simple way to transform data from one format to another.
## Installation
```bash
go get github.com/zeiss/go-transform
```## Usage
```go
type example struct {
Name string `tansform:"trim,lowercase"`
}t := transform.New()
e := example{Name: " John Doe "}if err := t.Transform(&e); err != nil {
log.Fatal(err)
}fmt.Println(e.Name) // Output: john doe
```## Transformations
This is the list of all available transformations:
| Function | Description |
| --- | --- |
| `trim` | Removes leading and trailing whitespace. |
| `lowercase` | Converts the string to lowercase. |
| `uppercase` | Converts the string to uppercase. |
| `rtrim` | Removes trailing whitespace. |
| `ltrim` | Removes leading whitespace. |
| `uppercase` | Converts the string to uppercase. |## License
[MIT](/LICENSE)