github.com/jackc/softstruct
Package softstruct provides "soft" structures that are created at runtime. The purpose of this package is to make it easy to parse and validate JSON or form submissions and to represent a runtime defined record. A Type is a definition of a structure. It is defined by a set of fields. Each field has a name and a set of ValueConverters. A ValueConverter is a function that converts a value to a different type or validates the value. A Record is an "instance" of a Type. It is created by calling Type.New with a map[string]any. The map is converted to a Record by applying the ValueConverters for each field. If any of the ValueConverters fail then the Record is considered invalid. The original map and the errors are stored in the Record.
proxy.golang.org
v0.0.0-20230624232114-60549214e5d3
over 2 years ago
1
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/jackc/softstruct
spec |
| License | MIT |
| Namespace | github.com/jackc |
| First Release | over 2 years ago |
| Last Synced | 16 days ago |
Repository
| Stars | 1 on GitHub |
| Forks | 0 on GitHub |