Commit 4b8063fb by zhengqiuyun86

数组差集算法

parent e8ce7b1a
......@@ -23,7 +23,7 @@ type Config struct {
func BaseConfig(conf Config) {
if util.IsEmpty(&conf.ServerName) {
exception.AssertThrowable("ServerName error")
exception.ThrowsErrS("SYSTEM_ERR", "ServerName error")
} else {
ServerName = conf.ServerName
}
......
......@@ -15,6 +15,7 @@ require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/gin-contrib/cors v1.4.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
......@@ -48,10 +49,8 @@ require (
)
require (
github.com/gin-contrib/cors v1.4.0
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a
github.com/swaggo/gin-swagger v1.5.2
gopkg.in/fatih/set.v0 v0.2.1
)
//package main
//
//import (
// "git.168cad.top/zhengqiuyun/rym-util/conf"
// "git.168cad.top/zhengqiuyun/rym-util/es"
// "git.168cad.top/zhengqiuyun/rym-util/log"
// "git.168cad.top/zhengqiuyun/rym-util/mysqlrym"
// "git.168cad.top/zhengqiuyun/rym-util/redis"
// "git.168cad.top/zhengqiuyun/rym-util/router"
//)
//
//func main() {
// log.Debug("测试")
// log.Info("测试")
// log.Warn("测试")
// log.Error("测试")
// conf.BaseConfig(conf.Config{
// ServerName: "rym-framework",
// Env: "dev",
// HttpPort: 1024,
// LogColorful: true,
// })
// mysqlrym.TestLog()
// es.TestLog()
// redis.TestLog()
// c := router.InitGinEngine(true)
// router.Run(c)
//}
package main
import (
"fmt"
"gopkg.in/fatih/set.v0"
"git.168cad.top/zhengqiuyun/rym-util/conf"
"git.168cad.top/zhengqiuyun/rym-util/es"
"git.168cad.top/zhengqiuyun/rym-util/log"
"git.168cad.top/zhengqiuyun/rym-util/mysqlrym"
"git.168cad.top/zhengqiuyun/rym-util/redis"
"git.168cad.top/zhengqiuyun/rym-util/router"
)
/*set并集 交集 差集计算示例*/
func main() {
a := set.New(set.ThreadSafe)
a.Add(1)
a.Add(2)
a.Add(3)
b := set.New(set.ThreadSafe)
b.Add(2)
b.Add(3)
b.Add(4)
//并集
unionSet := set.Union(a, b)
fmt.Printf("并集:%v\n", unionSet)
//交集
intersectionSet := set.Intersection(a, b)
fmt.Printf("交集:%v\n", intersectionSet)
//差集
diffS1S2 := set.Difference(a, b)
fmt.Printf("差集(属a不属b):%v\n", diffS1S2)
diffS2S1 := set.Difference(b, a)
fmt.Printf("差集(属b不属a):%v\n", diffS2S1)
log.Debug("测试")
log.Info("测试")
log.Warn("测试")
log.Error("测试")
conf.BaseConfig(conf.Config{
ServerName: "rym-framework",
Env: "dev",
HttpPort: 1024,
LogColorful: true,
})
mysqlrym.TestLog()
es.TestLog()
redis.TestLog()
c := router.InitGinEngine(true)
router.Run(c)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment