diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index d6e9a8ae..db2c4fde 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -15,7 +15,7 @@ body: - type: textarea attributes: label: Module version info - description: Output of `go list -m -u github.com/essentialkaos/ek/v12` command + description: Output of `go list -m -u github.com/essentialkaos/ek/v13` command render: shell validations: required: true diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml index 69c29567..3b0a3429 100644 --- a/.github/ISSUE_TEMPLATE/question.yml +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -22,7 +22,7 @@ body: - type: textarea attributes: label: Related module version info - description: Output of `go list -m -u github.com/essentialkaos/ek/v12` command + description: Output of `go list -m -u github.com/essentialkaos/ek/v13` command render: shell validations: required: true diff --git a/.scripts/fuzz-gen.sh b/.scripts/fuzz-gen.sh index 2ff531d2..652bd2ce 100755 --- a/.scripts/fuzz-gen.sh +++ b/.scripts/fuzz-gen.sh @@ -72,12 +72,12 @@ main() { if [[ "$src_func" == "Fuzz" ]] ; then showm " ${CL_GREY}∙ ${CL_BOLD}${src_package}${CL_NORM}… " output="${src_name}-fuzz.zip" - go-fuzz-build -o "$output" "github.com/essentialkaos/ek/v12/${src_path}" &> /dev/null + go-fuzz-build -o "$output" "github.com/essentialkaos/ek/v13/${src_path}" &> /dev/null else showm " ${CL_GREY}∙ ${CL_BOLD}${src_package}${CL_NORM} ${CL_GREY}($src_func)${CL_NORM}… " func_min=$(echo "$src_func" | sed 's/Fuzz//' | tr '[:upper:]' '[:lower:]') output="${src_name}-${func_min}-fuzz.zip" - go-fuzz-build -func "$src_func" -o "$output" "github.com/essentialkaos/ek/v12/${src_path}" &> /dev/null + go-fuzz-build -func "$src_func" -o "$output" "github.com/essentialkaos/ek/v13/${src_path}" &> /dev/null fi # shellcheck disable=SC2181 diff --git a/CHANGELOG.md b/CHANGELOG.md index d183f2d8..c6298d25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ ## Changelog +### [13.0.0](https://kaos.sh/ek/13.0.0) + +> [!CAUTION] +> In this release, we have changed the logic behind some knf validators (`Less`, `Greater`, `LenLess`, `LenGreater`) from negative to positive check. This means that if you have any of these validators, you need to swap them (`Less` → `Greater`, `Greater` → `Less`, `LenLess` → `LenGreater`, `LenGreater` → `LenLess`) to keep the logic of the validation. + +- `[knf/validators]` Changed logic from negative to positive check for `Less`, `Greater`, `LenLess`, and `LenGreater` validators. +- `[knf/validators]` Validator `LenNotEquals` renamed to `LenEquals` +- `[knf/validators]` Validator `NotPrefix` renamed to `NotPrefix` +- `[knf/validators]` Validator `HasSuffix` renamed to `HasSuffix` +- `[knf/validators]` Validator `Equals` renamed to `NotEquals` +- `[log]` Code refactoring + +--- + ### [12.130.0](https://kaos.sh/ek/12.130.0) - `[knf/validators]` Added validators `Set`, `SetToAny`, `SetToAnyIgnoreCase`, `LenLess`, `LenGreater`, and `LenNotEquals` diff --git a/README.md b/README.md index 332126cf..503728a6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@
-
-
+
@@ -30,73 +29,73 @@ Currently we support Linux and macOS (_except some packages_). All packages have
### Sub-packages
-- [`ansi`](https://kaos.sh/g/ek.v12/ansi) — Package provides methods for working with ANSI/VT100 control sequences
-- [`cache`](https://kaos.sh/g/ek.v12/cache) — Package provides a simple in-memory key/value cache
-- [`color`](https://kaos.sh/g/ek.v12/color) — Package provides methods for working with colors
-- [`cron`](https://kaos.sh/g/ek.v12/cron) — Package provides methods for working with cron expressions
-- [`csv`](https://kaos.sh/g/ek.v12/csv) — Package with simple CSV parser compatible with default Go parser
-- [`easing`](https://kaos.sh/g/ek.v12/easing) — Package with easing functions (_Back, Bounce, Circ, Cubic, Elastic, Expo, Linear, Quad, Quint, Sine_)
-- [`emoji`](https://kaos.sh/g/ek.v12/emoji) — Package provides methods for working with emojis
-- [`env`](https://kaos.sh/g/ek.v12/env) — Package provides methods for working with environment variables
-- [`errutil`](https://kaos.sh/g/ek.v12/errutil) — Package provides methods for working with errors
-- [`events`](https://kaos.sh/g/ek.v12/events) — Package provides methods and structs for creating event-driven systems
-- [`directio`](https://kaos.sh/g/ek.v12/directio) — Package provides methods for reading/writing files with direct io
-- [`fmtc`](https://kaos.sh/g/ek.v12/fmtc) — Package provides methods similar to fmt for colored output ([_more info and examples_](fmtc/README.md))
-- [`fmtutil`](https://kaos.sh/g/ek.v12/fmtutil) — Package provides methods for output formatting
-- [`fmtutil/barcode`](https://kaos.sh/g/ek.v12/fmtutil/barcode) — Package provides methods to generate colored representation of unique data
-- [`fmtutil/panel`](https://kaos.sh/g/ek.v12/fmtutil/panel) — Package contains methods for rendering panels with text
-- [`fmtutil/table`](https://kaos.sh/g/ek.v12/fmtutil/table) — Package contains methods and structs for rendering data in tabular format
-- [`fsutil`](https://kaos.sh/g/ek.v12/fsutil) — Package provides methods for working with files on POSIX compatible systems (_BSD/Linux/macOS_)
-- [`hash`](https://kaos.sh/g/ek.v12/hash) — Package hash contains different hash algorithms and utilities
-- [`httputil`](https://kaos.sh/g/ek.v12/httputil) — Package provides methods for working with HTTP request/responses
-- [`i18n`](https://kaos.sh/g/ek.v12/i18n) — Package provides methods and structs for internationalization
-- [`initsystem`](https://kaos.sh/g/ek.v12/initsystem) — Package provides methods for working with different init systems (_sysv, upstart, systemd_)
-- [`initsystem/sdnotify`](https://kaos.sh/g/ek.v12/initsystem/sdnotify) — Package provides methods methods for sending [notifications to systemd](https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html#Well-known%20assignments)
-- [`jsonutil`](https://kaos.sh/g/ek.v12/jsonutil) — Package provides methods for working with JSON data
-- [`knf`](https://kaos.sh/g/ek.v12/knf) — Package provides methods for working with configuration files in [KNF format](https://kaos.sh/knf-spec)
-- [`knf/united`](https://kaos.sh/g/ek.v12/knf/united) — Package provides united configuration (_knf + options + environment variables_)
-- [`log`](https://kaos.sh/g/ek.v12/log) — Package with an improved logger
-- [`lock`](https://kaos.sh/g/ek.v12/lock) — Package provides methods for working with lock files
-- [`lscolors`](https://kaos.sh/g/ek.v12/lscolors) — Package provides methods for colorizing file names based on colors from dircolors
-- [`mathutil`](https://kaos.sh/g/ek.v12/mathutil) — Package provides some additional math methods
-- [`netutil`](https://kaos.sh/g/ek.v12/netutil) — Package provides methods for working with network
-- [`options`](https://kaos.sh/g/ek.v12/options) — Package provides methods for working with command-line options
-- [`pager`](https://kaos.sh/g/ek.v12/pager) — Package provides methods for pager setup (_like_ `more`/`less`)
-- [`passthru`](https://kaos.sh/g/ek.v12/passthru) — Package provides Reader and Writer with information about the amount of data being passed
-- [`passwd`](https://kaos.sh/g/ek.v12/passwd) — Package contains methods for working with passwords
-- [`path`](https://kaos.sh/g/ek.v12/path) — Package for working with paths (_fully compatible with base path package_)
-- [`pid`](https://kaos.sh/g/ek.v12/pid) — Package for working with PID files
-- [`pluralize`](https://kaos.sh/g/ek.v12/pluralize) — Package provides methods for pluralization
-- [`progress`](https://kaos.sh/g/ek.v12/progress) — Package provides methods and structs for creating terminal progress bar
-- [`protip`](https://kaos.sh/g/ek.v12/protip) — Package for displaying usage tips
-- [`rand`](https://kaos.sh/g/ek.v12/rand) — Package for generating random data
-- [`req`](https://kaos.sh/g/ek.v12/req) — Package simplify working with an HTTP requests
-- [`secstr`](https://kaos.sh/g/ek.v12/secstr) — Package provides methods and structs for working with protected (_secure_) strings
-- [`signal`](https://kaos.sh/g/ek.v12/signal) — Package provides methods for handling POSIX signals
-- [`sliceutil`](https://kaos.sh/g/ek.v12/sliceutil) — Package provides methods for working with slices
-- [`sortutil`](https://kaos.sh/g/ek.v12/sortutil) — Package provides methods for sorting slices
-- [`spellcheck`](https://kaos.sh/g/ek.v12/spellcheck) — Package provides spellcheck based on Damerau–Levenshtein distance algorithm
-- [`spinner`](https://kaos.sh/g/ek.v12/spinner) — Package provides methods for creating spinner animation for long-running tasks
-- [`strutil`](https://kaos.sh/g/ek.v12/strutil) — Package provides methods for working with strings
-- [`support`](https://kaos.sh/g/ek.v12/support) — Package provides methods for collecting and printing support information about system
-- [`system/container`](https://kaos.sh/g/ek.v12/system/container) — Package provides methods for checking container engine info
-- [`system/exec`](https://kaos.sh/g/ek.v12/system/exec) — Package provides methods for executing commands
-- [`system/process`](https://kaos.sh/g/ek.v12/system/process) — Package provides methods for gathering information about active processes
-- [`system/procname`](https://kaos.sh/g/ek.v12/system/procname) — Package provides methods for changing process name in the process tree
-- [`system/sensors`](https://kaos.sh/g/ek.v12/system/sensors) — Package provide methods for collecting sensors information
-- [`system`](https://kaos.sh/g/ek.v12/system) — Package provides methods for working with system data (_system metrics/users_)
-- [`terminal`](https://kaos.sh/g/ek.v12/terminal) — Package provides methods for printing messages to terminal
-- [`terminal/input`](https://kaos.sh/g/ek.v12/terminal/input) — Package provides methods for working with user input
-- [`terminal/tty`](https://kaos.sh/g/ek.v12/terminal/tty) — Package provides methods for working with TTY
-- [`timeutil`](https://kaos.sh/g/ek.v12/timeutil) — Package provides methods for working with time and date
-- [`tmp`](https://kaos.sh/g/ek.v12/tmp) — Package provides methods for working with temporary data
-- [`usage`](https://kaos.sh/g/ek.v12/usage) — Package usage provides methods and structs for generating usage info for command-line tools
-- [`usage/update`](https://kaos.sh/g/ek.v12/usage/update) — Package contains update checkers for different services
-- [`usage/completion/bash`](https://kaos.sh/g/ek.v12/usage/completion/bash) — Package provides methods for generating bash completion
-- [`usage/completion/fish`](https://kaos.sh/g/ek.v12/usage/completion/fish) — Package provides methods for generating fish completion
-- [`usage/completion/zsh`](https://kaos.sh/g/ek.v12/usage/completion/zsh) — Package provides methods for generating zsh completion
-- [`uuid`](https://kaos.sh/g/ek.v12/uuid) — Package provides methods for generating version 4 and 5 UUID's
-- [`version`](https://kaos.sh/g/ek.v12/version) — Package version provides methods for working with semver version info
+- [`ansi`](https://kaos.sh/g/ek.v13/ansi) — Package provides methods for working with ANSI/VT100 control sequences
+- [`cache`](https://kaos.sh/g/ek.v13/cache) — Package provides a simple in-memory key/value cache
+- [`color`](https://kaos.sh/g/ek.v13/color) — Package provides methods for working with colors
+- [`cron`](https://kaos.sh/g/ek.v13/cron) — Package provides methods for working with cron expressions
+- [`csv`](https://kaos.sh/g/ek.v13/csv) — Package with simple CSV parser compatible with default Go parser
+- [`easing`](https://kaos.sh/g/ek.v13/easing) — Package with easing functions (_Back, Bounce, Circ, Cubic, Elastic, Expo, Linear, Quad, Quint, Sine_)
+- [`emoji`](https://kaos.sh/g/ek.v13/emoji) — Package provides methods for working with emojis
+- [`env`](https://kaos.sh/g/ek.v13/env) — Package provides methods for working with environment variables
+- [`errutil`](https://kaos.sh/g/ek.v13/errutil) — Package provides methods for working with errors
+- [`events`](https://kaos.sh/g/ek.v13/events) — Package provides methods and structs for creating event-driven systems
+- [`directio`](https://kaos.sh/g/ek.v13/directio) — Package provides methods for reading/writing files with direct io
+- [`fmtc`](https://kaos.sh/g/ek.v13/fmtc) — Package provides methods similar to fmt for colored output ([_more info and examples_](fmtc/README.md))
+- [`fmtutil`](https://kaos.sh/g/ek.v13/fmtutil) — Package provides methods for output formatting
+- [`fmtutil/barcode`](https://kaos.sh/g/ek.v13/fmtutil/barcode) — Package provides methods to generate colored representation of unique data
+- [`fmtutil/panel`](https://kaos.sh/g/ek.v13/fmtutil/panel) — Package contains methods for rendering panels with text
+- [`fmtutil/table`](https://kaos.sh/g/ek.v13/fmtutil/table) — Package contains methods and structs for rendering data in tabular format
+- [`fsutil`](https://kaos.sh/g/ek.v13/fsutil) — Package provides methods for working with files on POSIX compatible systems (_BSD/Linux/macOS_)
+- [`hash`](https://kaos.sh/g/ek.v13/hash) — Package hash contains different hash algorithms and utilities
+- [`httputil`](https://kaos.sh/g/ek.v13/httputil) — Package provides methods for working with HTTP request/responses
+- [`i18n`](https://kaos.sh/g/ek.v13/i18n) — Package provides methods and structs for internationalization
+- [`initsystem`](https://kaos.sh/g/ek.v13/initsystem) — Package provides methods for working with different init systems (_sysv, upstart, systemd_)
+- [`initsystem/sdnotify`](https://kaos.sh/g/ek.v13/initsystem/sdnotify) — Package provides methods methods for sending [notifications to systemd](https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html#Well-known%20assignments)
+- [`jsonutil`](https://kaos.sh/g/ek.v13/jsonutil) — Package provides methods for working with JSON data
+- [`knf`](https://kaos.sh/g/ek.v13/knf) — Package provides methods for working with configuration files in [KNF format](https://kaos.sh/knf-spec)
+- [`knf/united`](https://kaos.sh/g/ek.v13/knf/united) — Package provides united configuration (_knf + options + environment variables_)
+- [`log`](https://kaos.sh/g/ek.v13/log) — Package with an improved logger
+- [`lock`](https://kaos.sh/g/ek.v13/lock) — Package provides methods for working with lock files
+- [`lscolors`](https://kaos.sh/g/ek.v13/lscolors) — Package provides methods for colorizing file names based on colors from dircolors
+- [`mathutil`](https://kaos.sh/g/ek.v13/mathutil) — Package provides some additional math methods
+- [`netutil`](https://kaos.sh/g/ek.v13/netutil) — Package provides methods for working with network
+- [`options`](https://kaos.sh/g/ek.v13/options) — Package provides methods for working with command-line options
+- [`pager`](https://kaos.sh/g/ek.v13/pager) — Package provides methods for pager setup (_like_ `more`/`less`)
+- [`passthru`](https://kaos.sh/g/ek.v13/passthru) — Package provides Reader and Writer with information about the amount of data being passed
+- [`passwd`](https://kaos.sh/g/ek.v13/passwd) — Package contains methods for working with passwords
+- [`path`](https://kaos.sh/g/ek.v13/path) — Package for working with paths (_fully compatible with base path package_)
+- [`pid`](https://kaos.sh/g/ek.v13/pid) — Package for working with PID files
+- [`pluralize`](https://kaos.sh/g/ek.v13/pluralize) — Package provides methods for pluralization
+- [`progress`](https://kaos.sh/g/ek.v13/progress) — Package provides methods and structs for creating terminal progress bar
+- [`protip`](https://kaos.sh/g/ek.v13/protip) — Package for displaying usage tips
+- [`rand`](https://kaos.sh/g/ek.v13/rand) — Package for generating random data
+- [`req`](https://kaos.sh/g/ek.v13/req) — Package simplify working with an HTTP requests
+- [`secstr`](https://kaos.sh/g/ek.v13/secstr) — Package provides methods and structs for working with protected (_secure_) strings
+- [`signal`](https://kaos.sh/g/ek.v13/signal) — Package provides methods for handling POSIX signals
+- [`sliceutil`](https://kaos.sh/g/ek.v13/sliceutil) — Package provides methods for working with slices
+- [`sortutil`](https://kaos.sh/g/ek.v13/sortutil) — Package provides methods for sorting slices
+- [`spellcheck`](https://kaos.sh/g/ek.v13/spellcheck) — Package provides spellcheck based on Damerau–Levenshtein distance algorithm
+- [`spinner`](https://kaos.sh/g/ek.v13/spinner) — Package provides methods for creating spinner animation for long-running tasks
+- [`strutil`](https://kaos.sh/g/ek.v13/strutil) — Package provides methods for working with strings
+- [`support`](https://kaos.sh/g/ek.v13/support) — Package provides methods for collecting and printing support information about system
+- [`system/container`](https://kaos.sh/g/ek.v13/system/container) — Package provides methods for checking container engine info
+- [`system/exec`](https://kaos.sh/g/ek.v13/system/exec) — Package provides methods for executing commands
+- [`system/process`](https://kaos.sh/g/ek.v13/system/process) — Package provides methods for gathering information about active processes
+- [`system/procname`](https://kaos.sh/g/ek.v13/system/procname) — Package provides methods for changing process name in the process tree
+- [`system/sensors`](https://kaos.sh/g/ek.v13/system/sensors) — Package provide methods for collecting sensors information
+- [`system`](https://kaos.sh/g/ek.v13/system) — Package provides methods for working with system data (_system metrics/users_)
+- [`terminal`](https://kaos.sh/g/ek.v13/terminal) — Package provides methods for printing messages to terminal
+- [`terminal/input`](https://kaos.sh/g/ek.v13/terminal/input) — Package provides methods for working with user input
+- [`terminal/tty`](https://kaos.sh/g/ek.v13/terminal/tty) — Package provides methods for working with TTY
+- [`timeutil`](https://kaos.sh/g/ek.v13/timeutil) — Package provides methods for working with time and date
+- [`tmp`](https://kaos.sh/g/ek.v13/tmp) — Package provides methods for working with temporary data
+- [`usage`](https://kaos.sh/g/ek.v13/usage) — Package usage provides methods and structs for generating usage info for command-line tools
+- [`usage/update`](https://kaos.sh/g/ek.v13/usage/update) — Package contains update checkers for different services
+- [`usage/completion/bash`](https://kaos.sh/g/ek.v13/usage/completion/bash) — Package provides methods for generating bash completion
+- [`usage/completion/fish`](https://kaos.sh/g/ek.v13/usage/completion/fish) — Package provides methods for generating fish completion
+- [`usage/completion/zsh`](https://kaos.sh/g/ek.v13/usage/completion/zsh) — Package provides methods for generating zsh completion
+- [`uuid`](https://kaos.sh/g/ek.v13/uuid) — Package provides methods for generating version 4 and 5 UUID's
+- [`version`](https://kaos.sh/g/ek.v13/version) — Package version provides methods for working with semver version info
### Projects with `EK`
diff --git a/color/color.go b/color/color.go
index 5a106eeb..fee183be 100644
--- a/color/color.go
+++ b/color/color.go
@@ -13,7 +13,7 @@ import (
"math"
"strconv"
- "github.com/essentialkaos/ek/v12/mathutil"
+ "github.com/essentialkaos/ek/v13/mathutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/color/color_test.go b/color/color_test.go
index cc1cad83..c515c81f 100644
--- a/color/color_test.go
+++ b/color/color_test.go
@@ -10,7 +10,7 @@ package color
import (
"testing"
- "github.com/essentialkaos/ek/v12/mathutil"
+ "github.com/essentialkaos/ek/v13/mathutil"
. "github.com/essentialkaos/check"
)
diff --git a/cron/cron.go b/cron/cron.go
index 81fce33e..332070f5 100644
--- a/cron/cron.go
+++ b/cron/cron.go
@@ -15,7 +15,7 @@ import (
"strings"
"time"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/ek.go b/ek.go
index 90952ccb..9c5ecce9 100644
--- a/ek.go
+++ b/ek.go
@@ -21,7 +21,7 @@ import (
// ////////////////////////////////////////////////////////////////////////////////// //
// VERSION is current ek package version
-const VERSION = "12.130.0"
+const VERSION = "13.0.0"
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fmtc/fmtc.go b/fmtc/fmtc.go
index 298a2d42..3779fc61 100644
--- a/fmtc/fmtc.go
+++ b/fmtc/fmtc.go
@@ -18,8 +18,8 @@ import (
"strings"
"sync"
- "github.com/essentialkaos/ek/v12/color"
- "github.com/essentialkaos/ek/v12/env"
+ "github.com/essentialkaos/ek/v13/color"
+ "github.com/essentialkaos/ek/v13/env"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fmtc/fmtc_test.go b/fmtc/fmtc_test.go
index 136b638f..3659b09b 100644
--- a/fmtc/fmtc_test.go
+++ b/fmtc/fmtc_test.go
@@ -13,7 +13,7 @@ import (
"os"
"testing"
- "github.com/essentialkaos/ek/v12/env"
+ "github.com/essentialkaos/ek/v13/env"
. "github.com/essentialkaos/check"
)
diff --git a/fmtutil/fmtutil.go b/fmtutil/fmtutil.go
index 41b0349a..37b56525 100644
--- a/fmtutil/fmtutil.go
+++ b/fmtutil/fmtutil.go
@@ -15,9 +15,9 @@ import (
"strconv"
"strings"
- "github.com/essentialkaos/ek/v12/ansi"
- "github.com/essentialkaos/ek/v12/mathutil"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/ansi"
+ "github.com/essentialkaos/ek/v13/mathutil"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fmtutil/panel/panel.go b/fmtutil/panel/panel.go
index 6c9770f6..b10aea89 100644
--- a/fmtutil/panel/panel.go
+++ b/fmtutil/panel/panel.go
@@ -12,11 +12,11 @@ import (
"bytes"
"strings"
- "github.com/essentialkaos/ek/v12/fmtc"
- "github.com/essentialkaos/ek/v12/fmtutil"
- "github.com/essentialkaos/ek/v12/mathutil"
- "github.com/essentialkaos/ek/v12/sliceutil"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/fmtc"
+ "github.com/essentialkaos/ek/v13/fmtutil"
+ "github.com/essentialkaos/ek/v13/mathutil"
+ "github.com/essentialkaos/ek/v13/sliceutil"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fmtutil/panel/panel_test.go b/fmtutil/panel/panel_test.go
index a4acb8cd..93cf61a3 100644
--- a/fmtutil/panel/panel_test.go
+++ b/fmtutil/panel/panel_test.go
@@ -10,7 +10,7 @@ package panel
import (
"testing"
- "github.com/essentialkaos/ek/v12/fmtc"
+ "github.com/essentialkaos/ek/v13/fmtc"
. "github.com/essentialkaos/check"
)
diff --git a/fmtutil/separator.go b/fmtutil/separator.go
index 25f429e0..5a682e47 100644
--- a/fmtutil/separator.go
+++ b/fmtutil/separator.go
@@ -10,8 +10,8 @@ package fmtutil
import (
"strings"
- "github.com/essentialkaos/ek/v12/fmtc"
- "github.com/essentialkaos/ek/v12/terminal/tty"
+ "github.com/essentialkaos/ek/v13/fmtc"
+ "github.com/essentialkaos/ek/v13/terminal/tty"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fmtutil/table/table.go b/fmtutil/table/table.go
index 79de426a..06f71043 100644
--- a/fmtutil/table/table.go
+++ b/fmtutil/table/table.go
@@ -12,10 +12,10 @@ import (
"fmt"
"strings"
- "github.com/essentialkaos/ek/v12/fmtc"
- "github.com/essentialkaos/ek/v12/mathutil"
- "github.com/essentialkaos/ek/v12/strutil"
- "github.com/essentialkaos/ek/v12/terminal/tty"
+ "github.com/essentialkaos/ek/v13/fmtc"
+ "github.com/essentialkaos/ek/v13/mathutil"
+ "github.com/essentialkaos/ek/v13/strutil"
+ "github.com/essentialkaos/ek/v13/terminal/tty"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fsutil/fs.go b/fsutil/fs.go
index 446aeff6..b144cdf4 100644
--- a/fsutil/fs.go
+++ b/fsutil/fs.go
@@ -20,8 +20,8 @@ import (
"syscall"
"time"
- PATH "github.com/essentialkaos/ek/v12/path"
- "github.com/essentialkaos/ek/v12/system"
+ PATH "github.com/essentialkaos/ek/v13/path"
+ "github.com/essentialkaos/ek/v13/system"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fsutil/fs_darwin.go b/fsutil/fs_darwin.go
index 5279e804..e985362f 100644
--- a/fsutil/fs_darwin.go
+++ b/fsutil/fs_darwin.go
@@ -15,7 +15,7 @@ import (
"syscall"
"time"
- PATH "github.com/essentialkaos/ek/v12/path"
+ PATH "github.com/essentialkaos/ek/v13/path"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fsutil/fs_freebsd.go b/fsutil/fs_freebsd.go
index 9e4d70e1..4502b79f 100644
--- a/fsutil/fs_freebsd.go
+++ b/fsutil/fs_freebsd.go
@@ -15,7 +15,7 @@ import (
"syscall"
"time"
- PATH "github.com/essentialkaos/ek/v12/path"
+ PATH "github.com/essentialkaos/ek/v13/path"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fsutil/fs_linux.go b/fsutil/fs_linux.go
index 85ae5160..6fe0c26c 100644
--- a/fsutil/fs_linux.go
+++ b/fsutil/fs_linux.go
@@ -15,7 +15,7 @@ import (
"syscall"
"time"
- PATH "github.com/essentialkaos/ek/v12/path"
+ PATH "github.com/essentialkaos/ek/v13/path"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fsutil/fs_test.go b/fsutil/fs_test.go
index cabe3308..23d1f2bf 100644
--- a/fsutil/fs_test.go
+++ b/fsutil/fs_test.go
@@ -15,7 +15,7 @@ import (
"testing"
"time"
- "github.com/essentialkaos/ek/v12/system"
+ "github.com/essentialkaos/ek/v13/system"
check "github.com/essentialkaos/check"
)
diff --git a/fsutil/fs_user.go b/fsutil/fs_user.go
index f9064963..cbd6cee4 100644
--- a/fsutil/fs_user.go
+++ b/fsutil/fs_user.go
@@ -12,7 +12,7 @@ package fsutil
// ////////////////////////////////////////////////////////////////////////////////// //
import (
- "github.com/essentialkaos/ek/v12/system"
+ "github.com/essentialkaos/ek/v13/system"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/fsutil/fs_user_unit.go b/fsutil/fs_user_unit.go
index 3cf11668..183d6356 100644
--- a/fsutil/fs_user_unit.go
+++ b/fsutil/fs_user_unit.go
@@ -13,7 +13,7 @@ package fsutil
import (
"errors"
- "github.com/essentialkaos/ek/v12/system"
+ "github.com/essentialkaos/ek/v13/system"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/go.mod b/go.mod
index bb4f35a2..139ae8ac 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/essentialkaos/ek/v12
+module github.com/essentialkaos/ek/v13
go 1.18
diff --git a/i18n/i18n.go b/i18n/i18n.go
index 3730d1e5..b704b11d 100644
--- a/i18n/i18n.go
+++ b/i18n/i18n.go
@@ -15,8 +15,8 @@ import (
"strings"
"text/template"
- "github.com/essentialkaos/ek/v12/fmtutil"
- "github.com/essentialkaos/ek/v12/pluralize"
+ "github.com/essentialkaos/ek/v13/fmtutil"
+ "github.com/essentialkaos/ek/v13/pluralize"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/initsystem/initsystem.go b/initsystem/initsystem.go
index 84a4565b..0c78d0ee 100644
--- a/initsystem/initsystem.go
+++ b/initsystem/initsystem.go
@@ -20,9 +20,9 @@ import (
"strings"
"syscall"
- "github.com/essentialkaos/ek/v12/env"
- "github.com/essentialkaos/ek/v12/fsutil"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/env"
+ "github.com/essentialkaos/ek/v13/fsutil"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/initsystem/initsystem_darwin.go b/initsystem/initsystem_darwin.go
index 997a6159..4618ead7 100644
--- a/initsystem/initsystem_darwin.go
+++ b/initsystem/initsystem_darwin.go
@@ -14,7 +14,7 @@ import (
"os/exec"
"strings"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/jsonutil/jsonutil_test.go b/jsonutil/jsonutil_test.go
index 7ee8a486..b3fa5502 100644
--- a/jsonutil/jsonutil_test.go
+++ b/jsonutil/jsonutil_test.go
@@ -14,7 +14,7 @@ import (
. "github.com/essentialkaos/check"
- "github.com/essentialkaos/ek/v12/fsutil"
+ "github.com/essentialkaos/ek/v13/fsutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/knf.go b/knf/knf.go
index ad2102d1..fc02da28 100644
--- a/knf/knf.go
+++ b/knf/knf.go
@@ -18,8 +18,8 @@ import (
"sync"
"time"
- "github.com/essentialkaos/ek/v12/knf/value"
- "github.com/essentialkaos/ek/v12/sliceutil"
+ "github.com/essentialkaos/ek/v13/knf/value"
+ "github.com/essentialkaos/ek/v13/sliceutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/united/example_test.go b/knf/united/example_test.go
index 915d9a60..c3e4c890 100644
--- a/knf/united/example_test.go
+++ b/knf/united/example_test.go
@@ -10,8 +10,8 @@ package united
import (
"fmt"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/options"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/options"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/united/united.go b/knf/united/united.go
index 3e7b7eed..2040b372 100644
--- a/knf/united/united.go
+++ b/knf/united/united.go
@@ -13,10 +13,10 @@ import (
"strings"
"time"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/knf/value"
- "github.com/essentialkaos/ek/v12/options"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/knf/value"
+ "github.com/essentialkaos/ek/v13/options"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/united/united_test.go b/knf/united/united_test.go
index fed5bafe..b3acf0d9 100644
--- a/knf/united/united_test.go
+++ b/knf/united/united_test.go
@@ -12,10 +12,10 @@ import (
"testing"
"time"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/options"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/options"
- knfv "github.com/essentialkaos/ek/v12/knf/validators"
+ knfv "github.com/essentialkaos/ek/v13/knf/validators"
. "github.com/essentialkaos/check"
)
@@ -257,7 +257,7 @@ func (s *UnitedSuite) TestValidation(c *C) {
global = nil
errs := Validate([]*knf.Validator{
- {"test:string", knfv.Empty, nil},
+ {"test:string", knfv.Set, nil},
})
c.Assert(errs, HasLen, 1)
@@ -278,8 +278,8 @@ func (s *UnitedSuite) TestValidation(c *C) {
c.Assert(err, IsNil)
errs = Validate([]*knf.Validator{
- {"test:string", knfv.Empty, nil},
- {"test:integer", knfv.Greater, 100},
+ {"test:string", knfv.Set, nil},
+ {"test:integer", knfv.Less, 100},
})
c.Assert(errs, HasLen, 1)
diff --git a/knf/validators/fs/validators.go b/knf/validators/fs/validators.go
index e667eca6..5a5b46ae 100644
--- a/knf/validators/fs/validators.go
+++ b/knf/validators/fs/validators.go
@@ -12,10 +12,10 @@ import (
"fmt"
"os"
- "github.com/essentialkaos/ek/v12/fsutil"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/path"
- "github.com/essentialkaos/ek/v12/system"
+ "github.com/essentialkaos/ek/v13/fsutil"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/path"
+ "github.com/essentialkaos/ek/v13/system"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/validators/fs/validators_test.go b/knf/validators/fs/validators_test.go
index 58995917..e4caf09e 100644
--- a/knf/validators/fs/validators_test.go
+++ b/knf/validators/fs/validators_test.go
@@ -13,7 +13,7 @@ import (
"runtime"
"testing"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
. "github.com/essentialkaos/check"
)
diff --git a/knf/validators/network/validators.go b/knf/validators/network/validators.go
index 522bedad..6ab0c262 100644
--- a/knf/validators/network/validators.go
+++ b/knf/validators/network/validators.go
@@ -14,7 +14,7 @@ import (
"net/url"
"strings"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/validators/network/validators_test.go b/knf/validators/network/validators_test.go
index b7d655b9..c7643487 100644
--- a/knf/validators/network/validators_test.go
+++ b/knf/validators/network/validators_test.go
@@ -11,7 +11,7 @@ import (
"os"
"testing"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
. "github.com/essentialkaos/check"
)
diff --git a/knf/validators/regexp/validators.go b/knf/validators/regexp/validators.go
index 83097f53..4417f051 100644
--- a/knf/validators/regexp/validators.go
+++ b/knf/validators/regexp/validators.go
@@ -12,7 +12,7 @@ import (
"fmt"
"regexp"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/validators/regexp/validators_test.go b/knf/validators/regexp/validators_test.go
index f09bdffe..7212c840 100644
--- a/knf/validators/regexp/validators_test.go
+++ b/knf/validators/regexp/validators_test.go
@@ -11,7 +11,7 @@ import (
"os"
"testing"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
check "github.com/essentialkaos/check"
)
diff --git a/knf/validators/system/validators.go b/knf/validators/system/validators.go
index 8a9944fa..290c2c35 100644
--- a/knf/validators/system/validators.go
+++ b/knf/validators/system/validators.go
@@ -12,8 +12,8 @@ package system
import (
"fmt"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/system"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/system"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/validators/system/validators_linux.go b/knf/validators/system/validators_linux.go
index fae83c11..ad7018f9 100644
--- a/knf/validators/system/validators_linux.go
+++ b/knf/validators/system/validators_linux.go
@@ -12,8 +12,8 @@ package system
import (
"fmt"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/system"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/system"
)
// ////////////////////////////////////////////////////////////////////////////////// //
diff --git a/knf/validators/system/validators_linux_test.go b/knf/validators/system/validators_linux_test.go
index e521fabc..039afe92 100644
--- a/knf/validators/system/validators_linux_test.go
+++ b/knf/validators/system/validators_linux_test.go
@@ -8,7 +8,7 @@ package system
// ////////////////////////////////////////////////////////////////////////////////// //
import (
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
. "github.com/essentialkaos/check"
)
diff --git a/knf/validators/system/validators_test.go b/knf/validators/system/validators_test.go
index 5d5a600a..078e0663 100644
--- a/knf/validators/system/validators_test.go
+++ b/knf/validators/system/validators_test.go
@@ -11,7 +11,7 @@ import (
"os"
"testing"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
. "github.com/essentialkaos/check"
)
diff --git a/knf/validators/validators.go b/knf/validators/validators.go
index ee560602..c19f64f1 100644
--- a/knf/validators/validators.go
+++ b/knf/validators/validators.go
@@ -13,8 +13,8 @@ import (
"strconv"
"strings"
- "github.com/essentialkaos/ek/v12/knf"
- "github.com/essentialkaos/ek/v12/strutil"
+ "github.com/essentialkaos/ek/v13/knf"
+ "github.com/essentialkaos/ek/v13/strutil"
)
// ////////////////////////////////////////////////////////////////////////////////// //
@@ -36,26 +36,26 @@ var (
// Greater returns error if property is greater than given number
Greater = validatorGreater
- // Equals returns error if property is equal to given string
- Equals = validatorEquals
+ // NotEquals returns error if property is equal to given string
+ NotEquals = validatorNotEquals
- // LenLess returns an error if the length of the property value is less than
+ // LenLess returns an error if the length of the property value is greater than
// given number
LenLess = validatorLenLess
- // LenGreater returns an error if the length of the property value is greater than
+ // LenGreater returns an error if the length of the property value is less than
// given number
LenGreater = validatorLenGreater
// LenNotEquals an error if the length of the property value is not equal to the
// given number
- LenNotEquals = validatorLenNotEquals
+ LenEquals = validatorLenEquals
- // NotPrefix returns error if property doesn't have given prefix
- NotPrefix = validatorNotPrefix
+ // HasPrefix returns error if property doesn't have given prefix
+ HasPrefix = validatorHasPrefix
- // NotPrefix returns error if property doesn't have given suffix
- NotSuffix = validatorNotSuffix
+ // HasSuffix returns error if property doesn't have given suffix
+ HasSuffix = validatorHasSuffix
// TypeBool returns error if property contains non-boolean value
TypeBool = validatorTypeBool
@@ -67,23 +67,6 @@ var (
TypeFloat = validatorTypeFloat
)
-var (
- // Empty returns error if property is empty
- //
- // Deprecated: Use validator Set instead
- Empty = validatorSet
-
- // NotContains returns error if property doesn't contains value from given slice
- //
- // Deprecated: Use validator SetToAny instead
- NotContains = validatorSetToAny
-
- // NotLen returns error if property has wrong size
- //
- // Deprecated: Use validator LenNotEquals instead
- NotLen = validatorNotLen
-)
-
// ////////////////////////////////////////////////////////////////////////////////// //
func validatorSet(config knf.IConfig, prop string, value any) error {
@@ -175,13 +158,13 @@ func validatorSetToAnyIgnoreCase(config knf.IConfig, prop string, value any) err
func validatorLess(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case int:
- if config.GetI(prop) < t {
- return fmt.Errorf("Property %s can't be less than %d", prop, t)
+ if config.GetI(prop) > t {
+ return fmt.Errorf("Property %s can't be greater than %d", prop, t)
}
case float64:
- if config.GetF(prop) < t {
- return fmt.Errorf("Property %s can't be less than %g", prop, t)
+ if config.GetF(prop) > t {
+ return fmt.Errorf("Property %s can't be greater than %g", prop, t)
}
default:
@@ -194,13 +177,13 @@ func validatorLess(config knf.IConfig, prop string, value any) error {
func validatorGreater(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case int:
- if config.GetI(prop) > t {
- return fmt.Errorf("Property %s can't be greater than %d", prop, t)
+ if config.GetI(prop) < t {
+ return fmt.Errorf("Property %s can't be less than %d", prop, t)
}
case float64:
- if config.GetF(prop) > t {
- return fmt.Errorf("Property %s can't be greater than %g", prop, t)
+ if config.GetF(prop) < t {
+ return fmt.Errorf("Property %s can't be less than %g", prop, t)
}
default:
@@ -210,7 +193,7 @@ func validatorGreater(config knf.IConfig, prop string, value any) error {
return nil
}
-func validatorEquals(config knf.IConfig, prop string, value any) error {
+func validatorNotEquals(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case int:
if config.GetI(prop) == t {
@@ -233,7 +216,7 @@ func validatorEquals(config knf.IConfig, prop string, value any) error {
}
default:
- return getValidatorInputError("Equals", prop, value)
+ return getValidatorInputError("NotEquals", prop, value)
}
return nil
@@ -242,8 +225,8 @@ func validatorEquals(config knf.IConfig, prop string, value any) error {
func validatorLenLess(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case int:
- if strutil.Len(config.GetS(prop)) < t {
- return fmt.Errorf("Property %s value can't be shorter than %d symbols", prop, t)
+ if strutil.Len(config.GetS(prop)) > t {
+ return fmt.Errorf("Property %s value can't be longer than %d symbols", prop, t)
}
default:
@@ -256,8 +239,8 @@ func validatorLenLess(config knf.IConfig, prop string, value any) error {
func validatorLenGreater(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case int:
- if strutil.Len(config.GetS(prop)) > t {
- return fmt.Errorf("Property %s value can't be longer than %d symbols", prop, t)
+ if strutil.Len(config.GetS(prop)) < t {
+ return fmt.Errorf("Property %s value can't be shorter than %d symbols", prop, t)
}
default:
@@ -267,7 +250,7 @@ func validatorLenGreater(config knf.IConfig, prop string, value any) error {
return nil
}
-func validatorLenNotEquals(config knf.IConfig, prop string, value any) error {
+func validatorLenEquals(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case int:
if strutil.Len(config.GetS(prop)) != t {
@@ -275,17 +258,17 @@ func validatorLenNotEquals(config knf.IConfig, prop string, value any) error {
}
default:
- return getValidatorInputError("LenNotEquals", prop, value)
+ return getValidatorInputError("LenEquals", prop, value)
}
return nil
}
-func validatorNotPrefix(config knf.IConfig, prop string, value any) error {
+func validatorHasPrefix(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case string:
if t == "" {
- return getValidatorEmptyInputError("NotPrefix", prop)
+ return getValidatorEmptyInputError("HasPrefix", prop)
}
if !strings.HasPrefix(config.GetS(prop), t) {
@@ -293,17 +276,17 @@ func validatorNotPrefix(config knf.IConfig, prop string, value any) error {
}
default:
- return getValidatorInputError("NotPrefix", prop, value)
+ return getValidatorInputError("HasPrefix", prop, value)
}
return nil
}
-func validatorNotSuffix(config knf.IConfig, prop string, value any) error {
+func validatorHasSuffix(config knf.IConfig, prop string, value any) error {
switch t := value.(type) {
case string:
if t == "" {
- return getValidatorEmptyInputError("NotSuffix", prop)
+ return getValidatorEmptyInputError("HasSuffix", prop)
}
if !strings.HasSuffix(config.GetS(prop), t) {
@@ -311,22 +294,7 @@ func validatorNotSuffix(config knf.IConfig, prop string, value any) error {
}
default:
- return getValidatorInputError("NotSuffix", prop, value)
- }
-
- return nil
-}
-
-// Deprecated
-func validatorNotLen(config knf.IConfig, prop string, value any) error {
- switch t := value.(type) {
- case int:
- if strutil.Len(config.GetS(prop)) != t {
- return fmt.Errorf("Property %s must be %d symbols long", prop, t)
- }
-
- default:
- return getValidatorInputError("NotLen", prop, value)
+ return getValidatorInputError("HasSuffix", prop, value)
}
return nil
diff --git a/knf/validators/validators_test.go b/knf/validators/validators_test.go
index f9981c4d..925f1941 100644
--- a/knf/validators/validators_test.go
+++ b/knf/validators/validators_test.go
@@ -11,7 +11,7 @@ import (
"os"
"testing"
- "github.com/essentialkaos/ek/v12/knf"
+ "github.com/essentialkaos/ek/v13/knf"
check "github.com/essentialkaos/check"
)
@@ -43,7 +43,7 @@ test1: 1
test7: no
[integer]
- test1: 1
+ test1: 5
test2: -5
test3: 10000000
test4: A
@@ -104,50 +104,50 @@ func (s *ValidatorSuite) TestBasicValidators(c *check.C) {
errs = knf.Validate([]*knf.Validator{
{"integer:test1", Set, nil},
- {"integer:test1", Less, 0},
- {"integer:test1", Less, 0.5},
- {"integer:test1", Greater, 10},
- {"integer:test1", Greater, 10.1},
- {"integer:test1", Equals, 10},
- {"integer:test1", Equals, 10.1},
- {"integer:test1", Equals, "123"},
- {"string:test3", NotPrefix, "45"},
- {"string:test3", NotSuffix, "00"},
- {"string:test1", LenLess, 3},
- {"string:test1", LenGreater, 10},
- {"string:test1", LenNotEquals, 4},
+ {"integer:test1", Greater, 0},
+ {"integer:test1", Greater, 0.5},
+ {"integer:test1", Less, 10},
+ {"integer:test1", Less, 10.1},
+ {"integer:test1", NotEquals, 10},
+ {"integer:test1", NotEquals, 10.1},
+ {"integer:test1", NotEquals, "123"},
+ {"string:test3", HasPrefix, "45"},
+ {"string:test3", HasSuffix, "00"},
+ {"string:test1", LenGreater, 3},
+ {"string:test1", LenLess, 10},
+ {"string:test1", LenEquals, 4},
})
c.Assert(errs, check.HasLen, 0)
errs = knf.Validate([]*knf.Validator{
{"boolean:test5", Set, nil},
- {"integer:test1", Less, 10},
- {"integer:test1", Greater, 0},
- {"integer:test1", Equals, 1},
+ {"integer:test1", Greater, 10},
+ {"integer:test1", Less, 3},
+ {"integer:test1", NotEquals, 5},
{"integer:test1", Greater, "12345"},
{"integer:test1", SetToAny, []string{"A", "B", "C"}},
{"integer:test1", SetToAnyIgnoreCase, []string{"A", "B", "C"}},
- {"string:test3", NotPrefix, "AB"},
- {"string:test3", NotSuffix, "CD"},
- {"string:test1", LenLess, 10},
- {"string:test1", LenGreater, 3},
- {"string:test1", LenNotEquals, 10},
+ {"string:test3", HasPrefix, "AB"},
+ {"string:test3", HasSuffix, "CD"},
+ {"string:test1", LenLess, 3},
+ {"string:test1", LenGreater, 10},
+ {"string:test1", LenEquals, 10},
})
c.Assert(errs, check.HasLen, 12)
c.Assert(errs[0].Error(), check.Equals, "Property boolean:test5 must be set")
c.Assert(errs[1].Error(), check.Equals, "Property integer:test1 can't be less than 10")
- c.Assert(errs[2].Error(), check.Equals, "Property integer:test1 can't be greater than 0")
- c.Assert(errs[3].Error(), check.Equals, "Property integer:test1 can't be equal 1")
+ c.Assert(errs[2].Error(), check.Equals, "Property integer:test1 can't be greater than 3")
+ c.Assert(errs[3].Error(), check.Equals, "Property integer:test1 can't be equal 5")
c.Assert(errs[4].Error(), check.Equals, "Validator knf.Greater doesn't support input with type