-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New Add/Remove prefix option Some libraries like [the gorm ORM](https://github.com/go-gorm/gorm) or the [gaum SQL query builder](https://github.com/shiftleftsecurity/gaum) use a prefix in the tag name (ie `gorm:"column:struct_field"`, gaum:"field_name=struct_field") to help ther Scanner/Valuer interact with the sql library in go. This PR adds the ability to add and remove said prefixes. I used these two libraries as samples in the tests files to help understand the rationale behind said feature to people reading without context, hopefully this doesn't break any project convention. * Add Readme section for prefix * Replaced prefix with format * Update main.go Accepting fatih's suggestion on flag doc Co-authored-by: Fatih Arslan <fatih@github.com> * Update README.md Accepting fatih's suggestion on `format` flag Co-authored-by: Fatih Arslan <fatih@github.com> * Update README.md Accepting fatih's suggestion on readme secion title Co-authored-by: Fatih Arslan <fatih@github.com> * Rename formatting var to valueFormat * Rename $value to $field for clarity * Update readme too Co-authored-by: Fatih Arslan <fatih@github.com>
- Loading branch information
1 parent
bdb461e
commit 128b480
Showing
7 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package foo | ||
|
||
type foo struct { | ||
bar string `gaum:"field_name=bar"` | ||
t bool `gaum:"field_name=t"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package foo | ||
|
||
type foo struct { | ||
bar string | ||
t bool | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package foo | ||
|
||
type foo struct { | ||
bar string `gaum:"field_name=bar"` | ||
timestamp time.Time `gaum:"@timestamp"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package foo | ||
|
||
type foo struct { | ||
bar string | ||
timestamp time.Time `gaum:"@timestamp"` | ||
} |