kevin 4 жил өмнө
parent
commit
e79c42add1

+ 1 - 1
core/stores/kv/store_test.go

@@ -381,7 +381,7 @@ func TestRedis_SortedSet(t *testing.T) {
 		rank, err := client.Zrank("key", "value2")
 		assert.Nil(t, err)
 		assert.Equal(t, int64(1), rank)
-		rank, err = client.Zrank("key", "value4")
+		_, err = client.Zrank("key", "value4")
 		assert.Equal(t, redis.Nil, err)
 		num, err := client.Zrem("key", "value2", "value3")
 		assert.Nil(t, err)

+ 1 - 0
readme.md

@@ -2,6 +2,7 @@
 
 [![Go](https://github.com/tal-tech/go-zero/workflows/Go/badge.svg?branch=master)](https://github.com/tal-tech/go-zero/actions)
 [![codecov](https://codecov.io/gh/tal-tech/go-zero/branch/master/graph/badge.svg)](https://codecov.io/gh/tal-tech/go-zero)
+[![Go Report Card](https://goreportcard.com/badge/github.com/tal-tech/go-zero)](https://goreportcard.com/report/github.com/tal-tech/go-zero)
 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
 
 ## 1. go-zero框架背景

+ 0 - 2
tools/goctl/api/parser/rootstate.go

@@ -99,8 +99,6 @@ func (s rootState) processToken(token string, annos []spec.Annotation) (state, e
 	switch token {
 	case infoDirective:
 		return newInfoState(s.baseState), nil
-	//case typeDirective:
-	//return newTypeState(s.baseState, annos), nil
 	case serviceDirective:
 		return newServiceState(s.baseState, annos), nil
 	default:

+ 8 - 6
tools/goctl/model/sql/parser/parser.go

@@ -42,14 +42,17 @@ func Parse(ddl string) (*Table, error) {
 	if err != nil {
 		return nil, err
 	}
+
 	ddlStmt, ok := stmt.(*sqlparser.DDL)
 	if !ok {
 		return nil, unSupportDDL
 	}
+
 	action := ddlStmt.Action
 	if action != sqlparser.CreateStr {
 		return nil, fmt.Errorf("expected [CREATE] action,but found: %s", action)
 	}
+
 	tableName := ddlStmt.NewName.Name.String()
 	tableSpec := ddlStmt.TableSpec
 	if tableSpec == nil {
@@ -58,7 +61,6 @@ func Parse(ddl string) (*Table, error) {
 
 	columns := tableSpec.Columns
 	indexes := tableSpec.Indexes
-
 	keyMap := make(map[string]KeyType)
 	for _, index := range indexes {
 		info := index.Info
@@ -69,6 +71,7 @@ func Parse(ddl string) (*Table, error) {
 			if len(index.Columns) > 1 {
 				return nil, errPrimaryKey
 			}
+
 			keyMap[index.Columns[0].Column.String()] = primary
 			continue
 		}
@@ -91,11 +94,9 @@ func Parse(ddl string) (*Table, error) {
 			keyMap[columnName] = normal
 		}
 	}
-	var (
-		fields     []Field
-		primaryKey Primary
-	)
 
+	var fields []Field
+	var primaryKey Primary
 	for _, column := range columns {
 		if column == nil {
 			continue
@@ -108,6 +109,7 @@ func Parse(ddl string) (*Table, error) {
 		if err != nil {
 			return nil, err
 		}
+
 		var field Field
 		field.Name = stringx.From(column.Name.String())
 		field.DataBaseType = column.Type.Type
@@ -126,10 +128,10 @@ func Parse(ddl string) (*Table, error) {
 		}
 		fields = append(fields, field)
 	}
+
 	return &Table{
 		Name:       stringx.From(tableName),
 		PrimaryKey: primaryKey,
 		Fields:     fields,
 	}, nil
-
 }