Skip to content

Commit

Permalink
fix: update README & delete ContextAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Apr 8, 2024
1 parent 6401426 commit 67b06d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ func TestGetAllowedRecordsForUser(t *testing.T) {
`gormadapter` supports adapter with context, the following is a timeout control implemented using context

```go
ca, _ := NewContextAdapter("mysql", "root:@tcp(127.0.0.1:3306)/", "casbin")
a, _ := gormadapter.NewAdapter("mysql", "mysql_username:mysql_password@tcp(127.0.0.1:3306)/") // Your driver and data source.
// Limited time 300s
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Microsecond)
defer cancel()
err := ca.AddPolicyCtx(ctx, "p", "p", []string{"alice", "data1", "read"})
err := a.AddPolicyCtx(ctx, "p", "p", []string{"alice", "data1", "read"})
if err != nil {
panic(err)
}
Expand Down
27 changes: 0 additions & 27 deletions context_adapter.go

This file was deleted.

0 comments on commit 67b06d2

Please sign in to comment.