casbin / casbin-pg-adapter

A go-pg adapter for casbin
https://github.com/casbin/casbin
Apache License 2.0
38 stars 28 forks source link

fix: adapter table name changed abnormally #28

Closed kilosonc closed 3 years ago

kilosonc commented 3 years ago

Signed-off-by: closetool c299999999@qq.com

Fix: #26

arafat-java commented 3 years ago

We don't recommend using reflection.

But the PR is using reflection. So are we good with this @hsluoyz @closetool ?

Also I was previously using pgAdapter.WithTableName(tableName) as follows pgAdapter.NewAdapterByDB(db, pgAdapter.WithTableName(tableName))

Now that method is gone. Can you please give a sample code for creating the adapter with table name specified

kilosonc commented 3 years ago

@arafat-java No, this PR won't be merged. We made an issue https://github.com/go-pg/pg/issues/1874.

hsluoyz commented 3 years ago

@closetool why we remove WithTableName()?

kilosonc commented 3 years ago

@hsluoyz Because it was replaced by WithTable

type Table1 CasbinRule
NewAdapterWithDB(db,WithTable(Table1{}))
hsluoyz commented 3 years ago

@closetool WithTable() uses struct, it's not good. We should add back WithTableName().

kilosonc commented 3 years ago

@hsluoyz emmmm, we should wait https://github.com/go-pg/pg/issues/1874 fixed, then we could add it back