Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-orusapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orus-io
go-orusapi
Commits
2defe6a5a126
Commit
2defe6a5a126
authored
3 years ago
by
Christophe de Vienne
Browse files
Options
Downloads
Patches
Plain Diff
Generate url builders
parent
5746457e68bc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#26811
passed
3 years ago
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/generate_db_helpers.go
+15
-0
15 additions, 0 deletions
scripts/generate_db_helpers.go
server.yaml
+5
-0
5 additions, 0 deletions
server.yaml
with
20 additions
and
0 deletions
scripts/generate_db_helpers.go
+
15
−
0
View file @
2defe6a5
...
...
@@ -275,6 +275,7 @@
PKeyColumn() string
Columns(withPKey bool) []string
Values(columns ...string) []interface{}
ValuesMap(columns ...string) map[string]interface{}
}
type TableSchema interface {
...
...
@@ -483,6 +484,20 @@
return values
}
// ValuesMap returns the values map for a list of columns. If a column does not
// exits, the corresponding value is left empty
func (s {{.Name}}) ValuesMap(columns ...string) map[string]interface{} {
values := make(map[string]interface{})
for _, column := range columns {
switch column {
{{- range .Fields}}
case "{{.Column}}":
values["{{.Column}}"] = s.{{.Name}}
{{- end}}
}
}
return values
}
{{- if .HasTable}}
func New{{.Name}}TableSchema() *{{.Name}}TableSchema {
...
...
This diff is collapsed.
Click to expand it.
server.yaml
+
5
−
0
View file @
2defe6a5
...
...
@@ -95,6 +95,11 @@
source
:
asset:serverOperation
target
:
"
{{
if
gt
(len
.Tags)
0
}}{{
joinFilePath
.Target
.ServerPackage
.APIPackage
.Package
}}{{
else
}}{{
joinFilePath
.Target
.ServerPackage
.Package
}}{{
end
}}"
file_name
:
"
{{
(snakize
(pascalize
.Name))
}}.go"
-
name
:
urlbuilder
source
:
"
asset:serverUrlbuilder"
target
:
"
{{
if
.UseTags
}}{{
joinFilePath
.Target
(toPackagePath
.ServerPackage)
(toPackagePath
.APIPackage)
(toPackagePath
.Package)
}}{{
else
}}{{
joinFilePath
.Target
(toPackagePath
.ServerPackage)
(toPackagePath
.Package)
}}{{
end
}}"
file_name
:
"
{{
(snakize
(pascalize
.Name))
}}_urlbuilder.go"
# custom templates
-
name
:
prometheus
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment