Skip to content

Commit

Permalink
Merge pull request #21 from origadmin/dev
Browse files Browse the repository at this point in the history
Merge dev into main
  • Loading branch information
godcong authored Nov 11, 2024
2 parents 3f574d2 + 1190720 commit 7372c7c
Show file tree
Hide file tree
Showing 48 changed files with 999 additions and 274 deletions.
10 changes: 5 additions & 5 deletions cmd/protoc-gen-go-gins/gins.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
)

const (
contextPackage = protogen.GoImportPath("context")
ginPackage = protogen.GoImportPath("github.com/gin-gonic/gin")
ginsPackage = protogen.GoImportPath("github.com/origadmin/toolkits/runtime/kratos/transport/gins")
transportHTTPPackage = protogen.GoImportPath("github.com/go-kratos/kratos/v2/transport/http")
bindingPackage = protogen.GoImportPath("github.com/go-kratos/kratos/v2/transport/http/binding")
contextPackage = protogen.GoImportPath("context")
ginPackage = protogen.GoImportPath("github.com/gin-gonic/gin")
ginsPackage = protogen.GoImportPath("github.com/origadmin/toolkits/runtime/transport/gins")
bindingPackage = protogen.GoImportPath("github.com/go-kratos/kratos/v2/transport/http/binding")
//transportHTTPPackage = protogen.GoImportPath("github.com/go-kratos/kratos/v2/transport/http")
)

var methodSets = make(map[string]int)
Expand Down
6 changes: 3 additions & 3 deletions dorm/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
)

// ExecFunc is a function that can be executed within a transaction
type ExecFunc func(context.Context) error
type ExecFunc = func(context.Context) error

// Trans is a transaction wrapper
type Trans interface {
Tx(ctx context.Context, fn func(tx Tx) error) error
TxExec(ctx context.Context, fn ExecFunc) error
Tx(ctx context.Context, fn func(context.Context) error) error
InTx(ctx context.Context, fn func(tx Tx) error) error
}

type Tx interface {
Expand Down
7 changes: 7 additions & 0 deletions errors/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ func (obj String) Is(err error) bool {
}

// ErrString creates a new error from a string
//
// Deprecated: use errors.NewString instead
func ErrString(err string) String {
return String(err)
}

// NewString creates a new error from a string
func NewString(message string) String {
return String(message)
}
10 changes: 8 additions & 2 deletions examples/buf.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/bufbuild/protovalidate
commit: 5a7b106cbb87462d9a8c9ffecdbd2e38
digest: b5:0f2dc6c9453e9cc9e9f36807aaa5f94022e837d91fef4dcaeed79a35c0843cc64eba28ff077aab24da3b2cb12639ad256246f9f9a36c033b99d5754b19996b7e
- name: buf.build/googleapis/googleapis
commit: f52d4f76a8434cc5966798b1d3b4f110
digest: b5:5e634ff0ee118aea188b3e9c13ad7d285a192ef6c591bc20ff5a3360438d6ca310cfe9d663b20d60e1daa21789add35b919eac84e8e94a4d576e83a50dd2d62c
commit: 553fd4b4b3a640be9b69a3fa0c17b383
digest: b5:9e7cb39758f3487f0751765227dc0b9f0ef7a401ab37fa2e97c363446810f4bd0dca1f46dbb793a12d98c019f4028e48d0831b5cb3f09190f068ec1866c69c1d
- name: buf.build/origadmin/runtime
commit: 157d05fd7b25402aa7aa58ed28f7a3b6
digest: b5:333b207fe1af60e28ba0db9aac8526638fcec6baab132dd9e3ce1603078836f245946d544dca965cb839864172024db3dbfa4d013d0b10e26361df36a2e2803f
1 change: 1 addition & 0 deletions examples/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ breaking:
- FILE
deps:
- buf.build/googleapis/googleapis
- buf.build/origadmin/runtime
# - buf.build/envoyproxy/protoc-gen-validate
5 changes: 5 additions & 0 deletions examples/proto/helloworld/v1/helloworld.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package helloworld.v1;

import "config/v1/cors.proto";
import "google/api/annotations.proto";

option go_package = "github.com/origadmin/toolkits/examples/services/helloworld/v1;helloworld";
Expand Down Expand Up @@ -29,3 +30,7 @@ message SayHelloRequest {
message SayHelloResponse {
string message = 1;
}

message ExampleCors {
config.v1.CorsConfig cors = 1;
}
92 changes: 73 additions & 19 deletions examples/services/helloworld/v1/helloworld.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions examples/services/helloworld/v1/helloworld.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7372c7c

Please sign in to comment.