forked from AmirSoleimani/VoucherCodeGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (42 loc) · 938 Bytes
/
main.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
47
48
49
50
package main
import (
"fmt"
"sync"
"voucher-code-generator/vcgen"
)
func main() {
// lolipop :P
wg := sync.WaitGroup{}
wg.Add(3)
// normal
go func(wg *sync.WaitGroup) {
vc := vcgen.New(&vcgen.Generator{Count: 10, Pattern: "###-###-###", Charset: "123456789"})
result, err := vc.Run()
if err != nil {
fmt.Println(err)
}
fmt.Println(result)
wg.Done()
}(&wg)
// with prefix
go func(wg *sync.WaitGroup) {
vcPrefix := vcgen.New(&vcgen.Generator{Count: 10, Pattern: "######", Prefix: "WELC-"})
result, err := vcPrefix.Run()
if err != nil {
fmt.Println(err)
}
fmt.Println(result)
wg.Done()
}(&wg)
// with prefix + postfix
go func(wg *sync.WaitGroup) {
vcPrePostfix := vcgen.New(&vcgen.Generator{Count: 10, Pattern: "######", Prefix: "WELC-", Postfix: "-B"})
result, err := vcPrePostfix.Run()
if err != nil {
fmt.Println(err)
}
fmt.Println(result)
wg.Done()
}(&wg)
wg.Wait()
}