Compare commits
No commits in common. "abc7b2679cf405f60ae0935519a97f962232d54c" and "3e564521e265ec9fd9879a05195c8e9973bdf432" have entirely different histories.
abc7b2679c
...
3e564521e2
|
@ -1,18 +0,0 @@
|
||||||
git add *
|
|
||||||
|
|
||||||
read -p "Commit message: " commit_message
|
|
||||||
|
|
||||||
git commit -m "$commit_message"
|
|
||||||
|
|
||||||
current_tag=$(git describe --abbrev=0 --tags)
|
|
||||||
IFS='.' read -ra tag_parts <<< "$current_tag"
|
|
||||||
major="${tag_parts[0]}"
|
|
||||||
minor="${tag_parts[1]}"
|
|
||||||
patch="${tag_parts[2]}"
|
|
||||||
patch=$((patch + 1))
|
|
||||||
new_tag="$major.$minor.$patch"
|
|
||||||
|
|
||||||
git tag "$new_tag"
|
|
||||||
|
|
||||||
git push -u origin main
|
|
||||||
git push --tags
|
|
|
@ -1,41 +0,0 @@
|
||||||
package rsvalidator
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ErrorResponse struct {
|
|
||||||
FailedField string
|
|
||||||
Tag string
|
|
||||||
Value string
|
|
||||||
}
|
|
||||||
|
|
||||||
var Validate = validator.New()
|
|
||||||
|
|
||||||
func ValidateStruct(event interface{}) []*ErrorResponse {
|
|
||||||
var errors []*ErrorResponse
|
|
||||||
err := Validate.Struct(event)
|
|
||||||
if err != nil {
|
|
||||||
for _, err := range err.(validator.ValidationErrors) {
|
|
||||||
var element ErrorResponse
|
|
||||||
element.FailedField = err.StructNamespace()
|
|
||||||
element.Tag = err.Tag()
|
|
||||||
element.Value = err.Param()
|
|
||||||
errors = append(errors, &element)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return errors
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateNumericString(fl validator.FieldLevel) bool {
|
|
||||||
str := fl.Field().String()
|
|
||||||
return strings.TrimSpace(str) != "" && regexp.MustCompile(`^[0-9]+$`).MatchString(str)
|
|
||||||
}
|
|
||||||
|
|
||||||
func test() {
|
|
||||||
log.Println("test")
|
|
||||||
}
|
|
Loading…
Reference in New Issue