Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rym-util
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengqiuyun
rym-util
Commits
4b8063fb
Commit
4b8063fb
authored
Oct 26, 2022
by
zhengqiuyun86
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数组差集算法
parent
e8ce7b1a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
54 deletions
+23
-54
conf.go
conf/conf.go
+1
-1
go.mod
go.mod
+1
-2
main.go
main.go
+21
-51
No files found.
conf/conf.go
View file @
4b8063fb
...
@@ -23,7 +23,7 @@ type Config struct {
...
@@ -23,7 +23,7 @@ type Config struct {
func
BaseConfig
(
conf
Config
)
{
func
BaseConfig
(
conf
Config
)
{
if
util
.
IsEmpty
(
&
conf
.
ServerName
)
{
if
util
.
IsEmpty
(
&
conf
.
ServerName
)
{
exception
.
AssertThrowable
(
"ServerName error"
)
exception
.
ThrowsErrS
(
"SYSTEM_ERR"
,
"ServerName error"
)
}
else
{
}
else
{
ServerName
=
conf
.
ServerName
ServerName
=
conf
.
ServerName
}
}
...
...
go.mod
View file @
4b8063fb
...
@@ -15,6 +15,7 @@ require (
...
@@ -15,6 +15,7 @@ require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // 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/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
...
@@ -48,10 +49,8 @@ require (
...
@@ -48,10 +49,8 @@ require (
)
)
require (
require (
github.com/gin-contrib/cors v1.4.0
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a
github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a
github.com/swaggo/gin-swagger v1.5.2
github.com/swaggo/gin-swagger v1.5.2
gopkg.in/fatih/set.v0 v0.2.1
)
)
main.go
View file @
4b8063fb
//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
package
main
import
(
import
(
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/conf"
"gopkg.in/fatih/set.v0"
"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
()
{
func
main
()
{
a
:=
set
.
New
(
set
.
ThreadSafe
)
log
.
Debug
(
"测试"
)
a
.
Add
(
1
)
log
.
Info
(
"测试"
)
a
.
Add
(
2
)
log
.
Warn
(
"测试"
)
a
.
Add
(
3
)
log
.
Error
(
"测试"
)
b
:=
set
.
New
(
set
.
ThreadSafe
)
conf
.
BaseConfig
(
conf
.
Config
{
b
.
Add
(
2
)
ServerName
:
"rym-framework"
,
b
.
Add
(
3
)
Env
:
"dev"
,
b
.
Add
(
4
)
HttpPort
:
1024
,
//并集
LogColorful
:
true
,
unionSet
:=
set
.
Union
(
a
,
b
)
})
fmt
.
Printf
(
"并集:%v
\n
"
,
unionSet
)
mysqlrym
.
TestLog
()
//交集
es
.
TestLog
()
intersectionSet
:=
set
.
Intersection
(
a
,
b
)
redis
.
TestLog
()
fmt
.
Printf
(
"交集:%v
\n
"
,
intersectionSet
)
c
:=
router
.
InitGinEngine
(
true
)
//差集
router
.
Run
(
c
)
diffS1S2
:=
set
.
Difference
(
a
,
b
)
fmt
.
Printf
(
"差集(属a不属b):%v
\n
"
,
diffS1S2
)
diffS2S1
:=
set
.
Difference
(
b
,
a
)
fmt
.
Printf
(
"差集(属b不属a):%v
\n
"
,
diffS2S1
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment