{"id":20062962,"url":"https://github.com/go-playground/mold","last_synced_at":"2025-05-15T12:03:56.428Z","repository":{"id":23659990,"uuid":"99537829","full_name":"go-playground/mold","owner":"go-playground","description":":scissors: Is a general library to help modify or set data within data structures and other objects.","archived":false,"fork":false,"pushed_at":"2024-12-29T18:52:52.000Z","size":79,"stargazers_count":262,"open_issues_count":7,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T22:18:35.984Z","etag":null,"topics":["clean","go","go-playground","golang","modify","mold","sanitize","scrub"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-playground.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-07T04:51:15.000Z","updated_at":"2025-04-12T15:27:07.000Z","dependencies_parsed_at":"2025-01-18T10:02:50.058Z","dependency_job_id":"580e567a-ca82-4625-af84-456e40c91c22","html_url":"https://github.com/go-playground/mold","commit_stats":{"total_commits":37,"total_committers":6,"mean_commits":6.166666666666667,"dds":0.6216216216216216,"last_synced_commit":"1d5da9df36be71171f5b59c1e36ce7c0eb918610"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-playground%2Fmold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-playground%2Fmold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-playground%2Fmold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-playground%2Fmold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-playground","download_url":"https://codeload.github.com/go-playground/mold/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clean","go","go-playground","golang","modify","mold","sanitize","scrub"],"created_at":"2024-11-13T13:39:43.999Z","updated_at":"2025-05-15T12:03:51.412Z","avatar_url":"https://github.com/go-playground.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Package mold\n============\n![Project status](https://img.shields.io/badge/version-4.5.1-green.svg)\n[![Build Status](https://travis-ci.org/go-playground/mold.svg?branch=v2)](https://travis-ci.org/go-playground/mold)\n[![Coverage Status](https://coveralls.io/repos/github/go-playground/mold/badge.svg?branch=v2)](https://coveralls.io/github/go-playground/mold?branch=v2)\n[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/mold)](https://goreportcard.com/report/github.com/go-playground/mold)\n[![GoDoc](https://godoc.org/github.com/go-playground/mold?status.svg)](https://godoc.org/github.com/go-playground/mold)\n![License](https://img.shields.io/dub/l/vibe-d.svg)\n\nPackage mold is a general library to help modify or set data within data structures and other objects.\n\nHow can this help me you ask, please see the examples [here](_examples/full/main.go)\n\nRequirements\n------------\n- Go 1.18+\n\nInstallation\n------------\n\nUse go get.\n```shell\ngo get -u github.com/go-playground/mold/v4\n```\n\nExamples\n----------\n| Example                          | Description                                                        |\n|----------------------------------|--------------------------------------------------------------------|\n| [simple](_examples/mold/main.go) | A basic example with custom function.                              |\n| [full](_examples/full/main.go)   | A more real life example combining the usage of multiple packages. |\n\n\nModifiers\n----------\nThese functions modify the data in-place.\n\n| Name                | Description                                                                               |\n|---------------------|-------------------------------------------------------------------------------------------|\n| camel               | Camel Cases the data.                                                                     |\n| default             | Sets the provided default value only if the data is equal to it's default datatype value. |\n| empty               | Sets the field equal to the datatype default value. e.g. 0 for int.                       |\n| lcase               | lowercases the data.                                                                      |\n| ltrim               | Trims spaces from the left of the data provided in the params.                            |\n| rtrim               | Trims spaces from the right of the data provided in the params.                           |\n| set                 | Set the provided value.                                                                   |\n| slug                | Converts the field to a [slug](https://github.com/gosimple/slug)                          |\n| snake               | Snake Cases the data.                                                                     |\n| strip_alpha         | Strips all ascii characters from the data.                                                |\n| strip_alpha_unicode | Strips all unicode characters from the data.                                              |\n| strip_num           | Strips all ascii numeric characters from the data.                                        |\n| strip_num_unicode   | Strips all unicode numeric characters from the data.                                      |\n| strip_punctuation   | Strips all ascii punctuation from the data.                                               |\n| title               | Title Cases the data.                                                                     |\n| tprefix             | Trims a prefix from the value using the provided param value.                             |\n| trim                | Trims space from the data.                                                                |\n| tsuffix             | Trims a suffix from the value using the provided param value.                             |\n| ucase               | Uppercases the data.                                                                      |\n| ucfirst             | Upper cases the first character of the data.                                              |\n\n**Special Notes:**\n`default` and `set` modifiers are special in that they can be used to set the value of a field or underlying type information or attributes and both use the same underlying function to set the data.\n\nSetting a Param will have the following special effects on data types where it's not just the value being set:\n- Chan - param used to set the buffer size, default = 0.\n- Slice - param used to set the capacity, default = 0.\n- Map - param used to set the size, default = 0.\n- time.Time - param used to set the time format OR value, default = time.Now(), `utc` = time.Now().UTC(), other tries to parse using RFC3339Nano and set a time value.\n\nScrubbers\n----------\nThese functions obfuscate the specified types within the data for pii purposes.\n\n| Name   | Description                                                       |\n|--------|-------------------------------------------------------------------|\n| emails | Scrubs multiple emails from data.                                 |\n| email  | Scrubs the data from and specifies the sha name of the same name. |\n| text   | Scrubs the data from and specifies the sha name of the same name. |\n| name   | Scrubs the data from and specifies the sha name of the same name. |\n| fname  | Scrubs the data from and specifies the sha name of the same name. |\n| lname  | Scrubs the data from and specifies the sha name of the same name. |\n\n\nSpecial Information\n-------------------\n- To use a comma(,) within your params replace use it's hex representation instead '0x2C' which will be replaced while caching.\n\nContributing\n------------\nI am definitely interested in the communities help in adding more scrubbers and modifiers.\nPlease send a PR with tests, and preferably no extra dependencies, at lease until a solid base\nhas been built.\n\nComplimentary Software\n----------------------\n\nHere is a list of software that compliments using this library post decoding.\n\n* [validator](https://github.com/go-playground/validator) - Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving.\n* [form](https://github.com/go-playground/form) - Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. Dual Array and Full map support.\n\nLicense\n------\nDistributed under MIT License, please see license file in code for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-playground%2Fmold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-playground%2Fmold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-playground%2Fmold/lists"}