Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
ulfssar-go
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Faizal Aziz
ulfssar-go
Commits
ad905139
Commit
ad905139
authored
Jan 05, 2024
by
Faizal Aziz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing constraint
parent
a1fd7bf5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
postgresql.go
dbcon/postgresql.go
+5
-2
No files found.
dbcon/postgresql.go
View file @
ad905139
...
...
@@ -345,6 +345,9 @@ func generateSQLFromStorage(tableName string, columnAndValues interface{}) strin
}
argName
:=
field
.
Tag
.
Get
(
"sql-constraint"
)
if
argName
!=
""
{
argName
=
"constraint "
+
argName
}
keysName
:=
field
.
Tag
.
Get
(
"sql-keys"
)
if
keysName
==
""
{
...
...
@@ -356,7 +359,7 @@ func generateSQLFromStorage(tableName string, columnAndValues interface{}) strin
argName
=
val
}
}
argName
=
fmt
.
Sprintf
(
"%s_%s"
,
keysName
,
argName
)
argName
=
fmt
.
Sprintf
(
"
constraint
%s_%s"
,
keysName
,
argName
)
}
}
...
...
@@ -365,5 +368,5 @@ func generateSQLFromStorage(tableName string, columnAndValues interface{}) strin
columnNamesStr
:=
strings
.
Replace
(
strings
.
TrimRight
(
columnNames
,
","
),
"DROP DATABASE"
,
""
,
1
)
return
fmt
.
Sprintf
(
"
'CREATE TABLE IF NOT EXISTS %s (%s)'
"
,
tableName
,
columnNamesStr
)
return
fmt
.
Sprintf
(
"
CREATE TABLE IF NOT EXISTS %s (%s);
"
,
tableName
,
columnNamesStr
)
}
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