mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
add comments
This commit is contained in:
@@ -168,6 +168,7 @@ var allCurrencyNames = map[string]bool{
|
|||||||
"ZWL": true, //Zimbabwe Dollar
|
"ZWL": true, //Zimbabwe Dollar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidCurrency returns whether the given currency is valid
|
||||||
func ValidCurrency(fl validator.FieldLevel) bool {
|
func ValidCurrency(fl validator.FieldLevel) bool {
|
||||||
if value, ok := fl.Field().Interface().(string); ok {
|
if value, ok := fl.Field().Interface().(string); ok {
|
||||||
if value == ParentAccountCurrencyPlaceholder {
|
if value == ParentAccountCurrencyPlaceholder {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/mayswind/lab/pkg/utils"
|
"github.com/mayswind/lab/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ValidEmail returns whether the given email is valid
|
||||||
func ValidEmail(fl validator.FieldLevel) bool {
|
func ValidEmail(fl validator.FieldLevel) bool {
|
||||||
if value, ok := fl.Field().Interface().(string); ok {
|
if value, ok := fl.Field().Interface().(string); ok {
|
||||||
if utils.IsValidEmail(value) {
|
if utils.IsValidEmail(value) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/mayswind/lab/pkg/utils"
|
"github.com/mayswind/lab/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ValidHexRGBColor returns whether the given hex reb color is valid
|
||||||
func ValidHexRGBColor(fl validator.FieldLevel) bool {
|
func ValidHexRGBColor(fl validator.FieldLevel) bool {
|
||||||
if value, ok := fl.Field().Interface().(string); ok {
|
if value, ok := fl.Field().Interface().(string); ok {
|
||||||
if utils.IsValidHexRGBColor(value) {
|
if utils.IsValidHexRGBColor(value) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NotBlank returns whether the given content is not blank
|
||||||
func NotBlank(fl validator.FieldLevel) bool {
|
func NotBlank(fl validator.FieldLevel) bool {
|
||||||
if value, ok := fl.Field().Interface().(string); ok {
|
if value, ok := fl.Field().Interface().(string); ok {
|
||||||
if value != "" && strings.Trim(value, " ") != "" {
|
if value != "" && strings.Trim(value, " ") != "" {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/mayswind/lab/pkg/utils"
|
"github.com/mayswind/lab/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ValidUsername returns whether the given user name is valid
|
||||||
func ValidUsername(fl validator.FieldLevel) bool {
|
func ValidUsername(fl validator.FieldLevel) bool {
|
||||||
if value, ok := fl.Field().Interface().(string); ok {
|
if value, ok := fl.Field().Interface().(string); ok {
|
||||||
if utils.IsValidUsername(value) {
|
if utils.IsValidUsername(value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user