Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

注释修正 #800

Merged
merged 7 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/routing/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func CompositeRoutingV1AndV2(v1rule *apiv1.Routing, level1, level2,
}

// BuildV1RoutesFromV2 根据 v2 版本的路由规则适配成 v1 版本的路由规则,分为别 inBounds 以及 outBounds
// retuen inBound outBound revisions
// return inBound outBound revisions
func BuildV1RoutesFromV2(service, namespace string, entries []*v2.ExtendRoutingConfig) ([]*apiv1.Route, []*apiv1.Route, []string) {
if len(entries) == 0 {
return []*apiv1.Route{}, []*apiv1.Route{}, []string{}
Expand Down Expand Up @@ -468,7 +468,7 @@ func ConvertV1RouteToV2Route(route *apiv1.Route) *apiv2.RuleRoutingConfig {
}
}

// CompareRoutingV2
// CompareRoutingV2 比较两个路由的优先级。
func CompareRoutingV2(a, b *v2.ExtendRoutingConfig) bool {
if a.Priority != b.Priority {
return a.Priority < b.Priority
Expand Down
28 changes: 13 additions & 15 deletions store/sqldb/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,22 @@ func parseDatabaseConf(opt map[string]interface{}) (*dbConfig, *dbConfig, error)
// parseStoreConfig 解析store的配置
func parseStoreConfig(opts interface{}) (*dbConfig, error) {
obj, ok := opts.(map[interface{}]interface{})
if !ok {
return nil, errors.New("database config is error")
}
dbType, _ := obj["dbType"].(string)
dbUser, _ := obj["dbUser"].(string)
dbPwd, _ := obj["dbPwd"].(string)
dbAddr, _ := obj["dbAddr"].(string)
dbName, _ := obj["dbName"].(string)
if dbType == "" || dbUser == "" || dbPwd == "" || dbAddr == "" || dbName == "" {
return nil, fmt.Errorf("config Plugin %s missing database param", STORENAME)

needCheckFields := map[string]string{"dbType": "", "dbUser": "", "dbPwd": "", "dbAddr": "", "dbName": ""}

for key := range needCheckFields {
needCheckFields[key], ok = obj[key].(string)
if !ok {
return nil, fmt.Errorf("config Plugin %s:%s type must be string", STORENAME, key)
}
}

c := &dbConfig{
dbType: dbType,
dbUser: dbUser,
dbPwd: dbPwd,
dbAddr: dbAddr,
dbName: dbName,
dbType: needCheckFields["dbType"],
dbUser: needCheckFields["dbUser"],
dbPwd: needCheckFields["dbPwd"],
dbAddr: needCheckFields["dbAddr"],
dbName: needCheckFields["dbName"],
}
if maxOpenConns, _ := obj["maxOpenConns"].(int); maxOpenConns > 0 {
c.maxOpenConns = maxOpenConns
Expand Down