go-doudou

go-doudou(doudou pronounce /dəudəu/)is OpenAPI 3.0 (for REST) spec and Protobuf v3 (for grpc) based lightweight microservice framework. It supports monolith service application as well.

MIT License

Stars
1.4K
Committers
16

Bot releases are visible (Hide)

go-doudou - v0.7.9

Published by wubin1989 almost 3 years ago

  1. Support loading multiple .env files for different environments like .env.dev.local, .env.test, .env.prod etc. If you use this feature, DON'T forget setting GDD_ENV environment from command line or Dockerfile or k8s configuration file or IDE run/debug configuration at first. See precedence--conventions
  2. Remove noisy warning WARN[0000] Error loading .env file: open xxx/xxx/.env: no such file or directory
  3. Add Includes and Excludes fields to Paging struct in esutils package to support source filtering feature of elasticsearch. See search-request-source-filtering.
  4. Add String method to Paging struct in esutils package to prints query in pretty json format for debug purpose
func TestPaging_String(t *testing.T) {
	p := Paging{
		StartDate: "2021-01-01",
		EndDate:   "2021-10-31",
		DateField: "submitTime",
		QueryConds: []QueryCond{
			{
				Pair: map[string][]interface{}{
					"user.keyword":     {"wubin1989"},
					"phone.keyword":    {"123456"},
					"district.keyword": {"Beijing"},
				},
				QueryLogic: MUST,
				QueryType:  TERMS,
			},
			{
				Pair: map[string][]interface{}{
					"score": {-1},
				},
				QueryLogic: MUSTNOT,
				QueryType:  TERMS,
			},
		},
	}
	fmt.Println(p.String())
}

Output:

{
  "bool": {
    "must": [
      {
        "range": {
          "submitTime": {
            "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis",
            "from": "2021-01-01",
            "include_lower": true,
            "include_upper": true,
            "time_zone": "Asia/Shanghai",
            "to": "2021-10-31"
          }
        }
      },
      {
        "terms": {
          "user.keyword": [
            "wubin1989"
          ]
        }
      },
      {
        "terms": {
          "phone.keyword": [
            "123456"
          ]
        }
      },
      {
        "terms": {
          "district.keyword": [
            "Beijing"
          ]
        }
      }
    ],
    "must_not": {
      "terms": {
        "score": [
          -1
        ]
      }
    }
  }
}
  1. Add -m flag to specify module name to go-doudou svc init subcommand e.g.:
    go-doudou svc init github.com/unionj-cloud/rabida -m github.com/unionj-cloud/rabida
  2. Support table alias to ddl query dsl builder e.g.:
where = C().Col("cc.survey_id").Eq(Literal("abc")).
  And(C().Col("cc.year").Eq(Literal(2021))).
  And(C().Col("cc.month").Eq(Literal(10))).
  And(C().Col("cc.stat_type").Eq(Literal(2)))
fmt.Println(where.Sql())

Output:

(((cc.`survey_id` = 'abc' and cc.`year` = '2021') and cc.`month` = '10') and cc.`stat_type` = '2')
go-doudou - v0.7.8

Published by wubin1989 almost 3 years ago

  1. Fix when execute go-doudou -v, output incorrect version
go-doudou - v0.7.7

Published by wubin1989 almost 3 years ago

  1. Improve slice type query string parameter support in generated http handler implementations such as?name[]=jack&name[]=lucy.
  2. Fix bug that there is no query string parameter description displaying in built-in go-doudou online doc.
go-doudou -

Published by wubin1989 about 3 years ago

  1. Separate built-in go-doudou endpoints from user custom api endpoints. It means when you call AddMiddleware and AddRoute functions, only affect your custom defined endpoints, not affect /go-doudou/doc, /go-doudou/openapi.json, /go-doudou/prometheus and /go-doudou/registry endpoints.
  2. NewDefaultHttpSrv() will return *DefaultHttpSrv instead of Srv interface. You can add your custom subrouters or middlewares to its exported field Router to implement your more complex business logic.
go-doudou -

Published by wubin1989 about 3 years ago

  • Fix several bugs related to ddl tool
  • Improve recover middleware's error log
go-doudou - v0.7.3

Published by wubin1989 about 3 years ago

go-doudou -

Published by wubin1989 about 3 years ago

go-doudou - v0.7.1

Published by wubin1989 about 3 years ago

  1. Fixed go-doudou svc run -w command bug: panic when there is a compile error, process should wait for fix and then restart automatically.
  2. Changed some code in handler implementation: when some parameters not received, leave zero value there, not return error. You can add custom logic by yourself there.
  3. Feature add: https://github.com/unionj-cloud/go-doudou/projects/1..., mock service implementation with the help of https://github.com/brianvoe/gofakeit. You can deploy the service without waiting all implementation done to let your frontend colleagues develop UI with fake responses. Your team can be more productive!
Package Rankings
Top 1.81% on Proxy.golang.org