Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
C
casbin-pg-adapter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
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
Abby Cin
casbin-pg-adapter
Commits
88e55925
Commit
88e55925
authored
Dec 28, 2019
by
khoipham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error can't bulk-insert empty slice []*pgadapter.CasbinRule
parent
7223ed5c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
adapter.go
adapter.go
+7
-4
adapter_test.go
adapter_test.go
+6
-0
No files found.
adapter.go
View file @
88e55925
...
...
@@ -211,10 +211,13 @@ func (a *Adapter) SavePolicy(model model.Model) error {
}
}
if
len
(
lines
)
>
0
{
_
,
err
=
a
.
db
.
Model
(
&
lines
)
.
OnConflict
(
"DO NOTHING"
)
.
Insert
()
return
err
}
return
nil
}
// AddPolicy adds a policy rule to the storage.
...
...
adapter_test.go
View file @
88e55925
...
...
@@ -221,6 +221,12 @@ func (s *AdapterTestSuite) TestSavePolicyClearPreviousData() {
_
,
err
:=
s
.
e
.
RemovePolicy
(
p
)
s
.
Require
()
.
NoError
(
err
)
}
policies
=
s
.
e
.
GetGroupingPolicy
()
policies
=
append
(
policies
[
:
0
:
0
],
policies
...
)
for
_
,
p
:=
range
policies
{
_
,
err
:=
s
.
e
.
RemoveGroupingPolicy
(
p
)
s
.
Require
()
.
NoError
(
err
)
}
s
.
assertPolicy
(
[][]
string
{},
s
.
e
.
GetPolicy
(),
...
...
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