You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,64 @@ s := sanitizer.New(sanitizer.OptionDateFormat{
82
82
})
83
83
```
84
84
85
+
### Custom Sanitizers
86
+
87
+
Use this option to register a custom sanitizer function. The sanitizer function is responsible for determining if the field's type is supported for that sanitizer.
88
+
89
+
The `Name` field tells us what tag name corresponds to the sanitizer.
90
+
91
+
The `Sanitizer` field tells us which sanitizer function to call when this tag is used. All sanitizers must have this signature: `func(s Sanitizer, structValue reflect.Value, idx int) error`.
92
+
93
+
```go
94
+
// exclaim adds punctuated enthusiasm to a string.
0 commit comments