-
-
Notifications
You must be signed in to change notification settings - Fork 51
Mongodb adapter wy #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hsluoyz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix my comments.
Moreover, please merge your commits into one.
adapter.go
Outdated
| } | ||
|
|
||
| db := session.DB(dI.Database) | ||
| collection := db.C(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name here should be "casbin_rule", because it's the table name, not the db name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, the name really is the table name. I found write the wrong notes when i push,but i have modified,so have three commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you should squash your commits into one in this PR. Because there's no need to see how you fix the errors in the commit history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you,I am a rookie. About this name modify, is it still necessary to submit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please join the Tencent QQ group for discussion: 546057381
adapter.go
Outdated
| } | ||
|
|
||
| // Can use provided database name. | ||
| func NewDBAdapter(url, name string) persist.Adapter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not create another constructor method. Just do it as how we did it in Xorm Adapter: https://github.com/casbin/xorm-adapter/blob/6d86407ce2631ca1f6f6943374c6129c5b03e190/adapter.go#L50-L75
Provide method can modify the table name.