-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_vse.go
46 lines (38 loc) · 916 Bytes
/
check_vse.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package done
import (
"strings"
"github.com/yyle88/zaplog"
"go.uber.org/zap"
)
type Vse struct {
V string
E error
*Vce[string]
}
func VSE(val string, err error) *Vse {
return &Vse{
V: val,
E: err,
Vce: VCE[string](val, err),
}
}
func (a *Vse) Equals(s string) {
if v := a.Done(); v != s {
zaplog.LOGS.P1.Panic("wrong", zap.String("v", v), zap.String("s", s))
}
}
func (a *Vse) HasPrefix(prefix string) {
if v := a.Done(); !strings.HasPrefix(v, prefix) {
zaplog.LOGS.P1.Panic("wrong", zap.String("v", v), zap.String("prefix", prefix))
}
}
func (a *Vse) HasSuffix(suffix string) {
if v := a.Done(); !strings.HasSuffix(v, suffix) {
zaplog.LOGS.P1.Panic("wrong", zap.String("v", v), zap.String("suffix", suffix))
}
}
func (a *Vse) Contains(sub string) {
if v := a.Done(); !strings.Contains(v, sub) {
zaplog.LOGS.P1.Panic("wrong", zap.String("v", v), zap.String("sub", sub))
}
}