Skip to content

Commit b3da62a

Browse files
committed
init
0 parents  commit b3da62a

Some content is hidden

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

51 files changed

+741
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* linguist-language=GO

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.buildpath
2+
.hgignore.swp
3+
.project
4+
.orig
5+
.swp
6+
.idea/
7+
.settings/
8+
.vscode/
9+
bin/
10+
**/.DS_Store
11+
gf
12+
main
13+
main.exe
14+
output/
15+
manifest/output/
16+
temp/
17+
temp.yaml
18+
bin
19+
**/config/config.yaml

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ROOT_DIR = $(shell pwd)
2+
NAMESPACE = "default"
3+
DEPLOY_NAME = "template-single"
4+
DOCKER_NAME = "template-single"
5+
6+
include ./hack/hack.mk

README.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# GoFrame Template For SingleRepo
2+
3+
Quick Start:
4+
- https://goframe.org/quick

api/hello/hello.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/hello/v1/hello.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package v1
2+
3+
import (
4+
"github.com/gogf/gf/v2/frame/g"
5+
)
6+
7+
type HelloReq struct {
8+
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
9+
}
10+
type HelloRes struct {
11+
g.Meta `mime:"text/html" example:"string"`
12+
}

api/user/user.go

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/user/v1/user.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package v1
2+
3+
import (
4+
"demo/internal/model/entity"
5+
6+
"github.com/gogf/gf/v2/frame/g"
7+
)
8+
9+
// Status marks user status.
10+
type Status int
11+
12+
const (
13+
StatusOK Status = 0 // User is OK.
14+
StatusDisabled Status = 1 // User is disabled.
15+
)
16+
17+
type CreateReq struct {
18+
g.Meta `path:"/user" method:"put" tags:"User" summary:"Create user"`
19+
Name string `v:"required|length:3,10" dc:"user name"`
20+
Age uint `v:"required|between:18,200" dc:"user age"`
21+
}
22+
type CreateRes struct {
23+
Id int64 `json:"id" dc:"user id"`
24+
}
25+
26+
type UpdateReq struct {
27+
g.Meta `path:"/user/{id}" method:"post" tags:"User" summary:"Update user"`
28+
Id int64 `v:"required" dc:"user id"`
29+
Name *string `v:"length:3,10" dc:"user name"`
30+
Age *uint `v:"between:18,200" dc:"user age"`
31+
Status *Status `v:"in:0,1" dc:"user status"`
32+
}
33+
type UpdateRes struct{}
34+
35+
type DeleteReq struct {
36+
g.Meta `path:"/user/{id}" method:"delete" tags:"User" summary:"Delete user"`
37+
Id int64 `v:"required" dc:"user id"`
38+
}
39+
type DeleteRes struct{}
40+
41+
type GetOneReq struct {
42+
g.Meta `path:"/user/{id}" method:"get" tags:"User" summary:"Get one user"`
43+
Id int64 `v:"required" dc:"user id"`
44+
}
45+
type GetOneRes struct {
46+
*entity.User `dc:"user"`
47+
}
48+
49+
type GetListReq struct {
50+
g.Meta `path:"/user" method:"get" tags:"User" summary:"Get users"`
51+
Age *uint `v:"between:18,200" dc:"user age"`
52+
Status *Status `v:"in:0,1" dc:"user age"`
53+
}
54+
type GetListRes struct {
55+
List []*entity.User `json:"list" dc:"user list"`
56+
}

go.mod

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module demo
2+
3+
go 1.18
4+
5+
require (
6+
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.0-beta
7+
github.com/gogf/gf/v2 v2.8.0-beta
8+
)
9+
10+
require (
11+
github.com/BurntSushi/toml v1.4.0 // indirect
12+
github.com/clbanning/mxj/v2 v2.7.0 // indirect
13+
github.com/emirpasic/gods v1.18.1 // indirect
14+
github.com/fatih/color v1.17.0 // indirect
15+
github.com/fsnotify/fsnotify v1.7.0 // indirect
16+
github.com/go-logr/logr v1.4.2 // indirect
17+
github.com/go-logr/stdr v1.2.2 // indirect
18+
github.com/go-sql-driver/mysql v1.7.1 // indirect
19+
github.com/gorilla/websocket v1.5.3 // indirect
20+
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
21+
github.com/magiconair/properties v1.8.7 // indirect
22+
github.com/mattn/go-colorable v0.1.13 // indirect
23+
github.com/mattn/go-isatty v0.0.20 // indirect
24+
github.com/mattn/go-runewidth v0.0.15 // indirect
25+
github.com/olekukonko/tablewriter v0.0.5 // indirect
26+
github.com/rivo/uniseg v0.4.7 // indirect
27+
go.opentelemetry.io/otel v1.24.0 // indirect
28+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
29+
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
30+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
31+
golang.org/x/net v0.27.0 // indirect
32+
golang.org/x/sys v0.22.0 // indirect
33+
golang.org/x/text v0.16.0 // indirect
34+
gopkg.in/yaml.v3 v3.0.1 // indirect
35+
)

go.sum

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
2+
github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
3+
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
4+
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
5+
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
6+
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
7+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
8+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
9+
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
10+
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.8.0-beta/go.mod h1:JGCO9LABUpe2URgFXH2Vlqs24LeBEyfMDEMPhAWrc9w=
11+
github.com/gogf/gf/v2 v2.8.0-beta/go.mod h1:6iYuZZ+A0ZcH8+4MDS/P0SvTPCvKzRvyAsY1kbkJYJc=
12+
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
13+
github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc=
14+
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
15+
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
16+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
17+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
18+
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
19+
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
20+
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
21+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
22+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
23+
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
24+
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
25+
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
26+
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
27+
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
28+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
29+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
30+
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
31+
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
32+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
33+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)