Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62584cf

Browse files
committed
updated
1 parent5f0cd06 commit62584cf

File tree

78 files changed

+6406
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+6406
-0
lines changed

‎.air.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
root ="."
2+
testdata_dir ="testdata"
3+
tmp_dir ="tmp"
4+
5+
[build]
6+
bin ="tmp\\main.exe"
7+
cmd ="go build -o ./tmp/main.exe ./cmd/server/main.go"
8+
delay =1000
9+
exclude_dir = ["assets","tmp","vendor","testdata"]
10+
exclude_file = []
11+
exclude_regex = ["_test.go"]
12+
exclude_unchanged =false
13+
follow_symlink =false
14+
full_bin =""
15+
include_dir = []
16+
include_ext = ["go","tpl","tmpl","html"]
17+
kill_delay ="0s"
18+
log ="build-errors.log"
19+
send_interrupt =false
20+
stop_on_error =true
21+
22+
[color]
23+
app =""
24+
build ="yellow"
25+
main ="magenta"
26+
runner ="green"
27+
watcher ="cyan"
28+
29+
[log]
30+
time =false
31+
32+
[misc]
33+
clean_on_exit =false
34+
35+
[screen]
36+
clear_on_rebuild =false

‎.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
.DS_Store
17+
TODO.md
18+
logs.txt
19+
.idea/
20+
secret.md
21+
app.env
22+
/temp
23+
temp/

‎Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.PHONY: dev dev-down go proto
2+
3+
dev:
4+
docker-compose up -d
5+
6+
dev-down:
7+
docker-compose down
8+
9+
go:
10+
air
11+
12+
proto:
13+
protoc --proto_path=proto --go_out=pb --go_opt=paths=source_relative\
14+
--go-grpc_out=pb --go-grpc_opt=paths=source_relative\
15+
proto/*.proto

‎client/createPost_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeCreatePostClientstruct {
14+
service pb.PostServiceClient
15+
}
16+
17+
funcNewCreatePostClient(conn*grpc.ClientConn)*CreatePostClient {
18+
service:=pb.NewPostServiceClient(conn)
19+
20+
return&CreatePostClient{service}
21+
}
22+
23+
func (createPostClient*CreatePostClient)CreatePost(args*pb.CreatePostRequest) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
res,err:=createPostClient.service.CreatePost(ctx,args)
29+
30+
iferr!=nil {
31+
log.Fatalf("CreatePost: %v",err)
32+
}
33+
34+
fmt.Println(res)
35+
}

‎client/deletePost_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeDeletePostClientstruct {
14+
service pb.PostServiceClient
15+
}
16+
17+
funcNewDeletePostClient(conn*grpc.ClientConn)*DeletePostClient {
18+
service:=pb.NewPostServiceClient(conn)
19+
20+
return&DeletePostClient{service}
21+
}
22+
23+
func (deletePostClient*DeletePostClient)DeletePost(args*pb.PostRequest) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
_,err:=deletePostClient.service.DeletePost(ctx,args)
29+
30+
iferr!=nil {
31+
log.Fatalf("DeletePost: %v",err)
32+
}
33+
34+
fmt.Println("Post deleted successfully")
35+
}

‎client/geMe_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeGetMeClientstruct {
14+
service pb.UserServiceClient
15+
}
16+
17+
funcNewGetMeClient(conn*grpc.ClientConn)*GetMeClient {
18+
service:=pb.NewUserServiceClient(conn)
19+
20+
return&GetMeClient{service}
21+
}
22+
23+
func (getMeClient*GetMeClient)GetMeUser(credentials*pb.GetMeRequest) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
res,err:=getMeClient.service.GetMe(ctx,credentials)
29+
30+
iferr!=nil {
31+
log.Fatalf("GeMe: %v",err)
32+
}
33+
34+
fmt.Println(res)
35+
}

‎client/getPost_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeGetPostClientstruct {
14+
service pb.PostServiceClient
15+
}
16+
17+
funcNewGetPostClient(conn*grpc.ClientConn)*GetPostClient {
18+
service:=pb.NewPostServiceClient(conn)
19+
20+
return&GetPostClient{service}
21+
}
22+
23+
func (getPostClient*GetPostClient)GetPost(args*pb.PostRequest) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
res,err:=getPostClient.service.GetPost(ctx,args)
29+
30+
iferr!=nil {
31+
log.Fatalf("GetPost: %v",err)
32+
}
33+
34+
fmt.Println(res)
35+
}

‎client/listPosts_client.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"io"
7+
"log"
8+
"time"
9+
10+
"github.com/wpcodevo/golang-mongodb/pb"
11+
"google.golang.org/grpc"
12+
)
13+
14+
typeListPostsClientstruct {
15+
service pb.PostServiceClient
16+
}
17+
18+
funcNewListPostsClient(conn*grpc.ClientConn)*ListPostsClient {
19+
service:=pb.NewPostServiceClient(conn)
20+
21+
return&ListPostsClient{service}
22+
}
23+
24+
func (listPostsClient*ListPostsClient)ListPosts(args*pb.GetPostsRequest) {
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
stream,err:=listPostsClient.service.GetPosts(ctx,args)
29+
iferr!=nil {
30+
log.Fatalf("ListPosts: %v",err)
31+
}
32+
33+
for {
34+
res,err:=stream.Recv()
35+
36+
iferr==io.EOF {
37+
break
38+
}
39+
40+
iferr!=nil {
41+
log.Fatalf("ListPosts: %v",err)
42+
}
43+
44+
fmt.Println(res)
45+
}
46+
47+
}

‎client/signin_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeSignInUserClientstruct {
14+
service pb.AuthServiceClient
15+
}
16+
17+
funcNewSignInUserClient(conn*grpc.ClientConn)*SignInUserClient {
18+
service:=pb.NewAuthServiceClient(conn)
19+
20+
return&SignInUserClient{service}
21+
}
22+
23+
func (signInUserClient*SignInUserClient)SignInUser(credentials*pb.SignInUserInput) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Second)
26+
defercancel()
27+
28+
res,err:=signInUserClient.service.SignInUser(ctx,credentials)
29+
30+
iferr!=nil {
31+
log.Fatalf("SignInUser: %v",err)
32+
}
33+
34+
fmt.Println(res)
35+
}

‎client/signup_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeSignUpUserClientstruct {
14+
service pb.AuthServiceClient
15+
}
16+
17+
funcNewSignUpUserClient(conn*grpc.ClientConn)*SignUpUserClient {
18+
service:=pb.NewAuthServiceClient(conn)
19+
20+
return&SignUpUserClient{service}
21+
}
22+
23+
func (signUpUserClient*SignUpUserClient)SignUpUser(credentials*pb.SignUpUserInput) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
res,err:=signUpUserClient.service.SignUpUser(ctx,credentials)
29+
30+
iferr!=nil {
31+
log.Fatalf("SignUpUser: %v",err)
32+
}
33+
34+
fmt.Println(res)
35+
}

‎client/updatePost_client.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package client
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"time"
8+
9+
"github.com/wpcodevo/golang-mongodb/pb"
10+
"google.golang.org/grpc"
11+
)
12+
13+
typeUpdatePostClientstruct {
14+
service pb.PostServiceClient
15+
}
16+
17+
funcNewUpdatePostClient(conn*grpc.ClientConn)*UpdatePostClient {
18+
service:=pb.NewPostServiceClient(conn)
19+
20+
return&UpdatePostClient{service}
21+
}
22+
23+
func (updatePostClient*UpdatePostClient)UpdatePost(args*pb.UpdatePostRequest) {
24+
25+
ctx,cancel:=context.WithTimeout(context.Background(),time.Duration(time.Millisecond*5000))
26+
defercancel()
27+
28+
res,err:=updatePostClient.service.UpdatePost(ctx,args)
29+
30+
iferr!=nil {
31+
log.Fatalf("UpdatePost: %v",err)
32+
}
33+
34+
fmt.Println(res)
35+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp