feat: Add Bind function for stripping HTML tags #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds a new function called Bind to the strip package. The Bind function takes an input interface and strips HTML tags from specific string fields in a struct. It iterates through the fields of the struct, checks for the presence of the "strip_tag" tag set to "true", and if found, it strips the HTML tags from the corresponding string field.
The Bind function ensures that the input is a pointer to a struct and that the dereferenced value is indeed a struct. It uses reflection to access and modify the field values.
This commit also includes a test case for the Bind function, which validates the functionality by creating a sample struct and asserting that the HTML tags are successfully stripped from the specified fields.