Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codebuilder
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张建华@五瓣科技
codebuilder
Commits
a13e6a08
Commit
a13e6a08
authored
May 07, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.生成结构体按照驼峰命名法
2.添加sql映射结构体类型
parent
8dc8664b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
DBUtil.go
util/DBUtil.go
+4
-3
No files found.
util/DBUtil.go
View file @
a13e6a08
...
@@ -77,10 +77,11 @@ func QueryTables() {
...
@@ -77,10 +77,11 @@ func QueryTables() {
func
Report
()
{
func
Report
()
{
fmt
.
Println
(
"》》............................映射结构体开始............................》》"
)
fmt
.
Println
(
"》》............................映射结构体开始............................》》"
)
for
tableName
,
ctMap
:=
range
queryResult
{
for
tableName
,
ctMap
:=
range
queryResult
{
goRes
.
Write
(
"
\n
type %s struct {
\n
"
,
tableName
)
structName
:=
CamelCase
(
tableName
)
goRes
.
Write
(
"
\n
type %s struct {
\n
"
,
structName
)
tsRes
.
Write
(
"
\n
export class %s {
\n
"
,
tableName
)
tsRes
.
Write
(
"
\n
export class %s {
\n
"
,
tableName
)
record
:=
"type "
record
:=
"type "
record
+=
table
Name
record
+=
struct
Name
record
+=
"
\t
struct {
\n
"
record
+=
"
\t
struct {
\n
"
for
colName
,
coltype
:=
range
ctMap
{
for
colName
,
coltype
:=
range
ctMap
{
//translate to go struct foramt
//translate to go struct foramt
...
@@ -119,7 +120,7 @@ func CamelCase(field string) string {
...
@@ -119,7 +120,7 @@ func CamelCase(field string) string {
ret
+=
strings
.
ToUpper
(
arr
[
str
][
0
:
1
])
+
arr
[
str
][
1
:
]
ret
+=
strings
.
ToUpper
(
arr
[
str
][
0
:
1
])
+
arr
[
str
][
1
:
]
}
}
}
else
{
}
else
{
return
field
return
strings
.
ToUpper
(
field
[
0
:
1
])
+
field
[
1
:
]
}
}
return
ret
return
ret
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment