Skip to content

ZEISS/go-transform

Repository files navigation

Transform

Test & Build Go Reference Go Report Card License: MIT Taylor Swift

Transform is a Go library that provides a simple way to transform data from one format to another.

Installation

go get github.com/zeiss/go-transform

Usage

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