Skip to content

Commit

Permalink
update go.mod
Browse files Browse the repository at this point in the history
  • Loading branch information
godcong committed May 6, 2024
1 parent f10a31d commit 3328c39
Show file tree
Hide file tree
Showing 23 changed files with 1,213 additions and 2,076 deletions.
22 changes: 10 additions & 12 deletions adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@ import (

"entgo.io/ent/dialect"
entsql "entgo.io/ent/dialect/sql"
"github.com/casbin/casbin/v2/model"
"github.com/casbin/casbin/v2/persist"
"github.com/casbin/ent-adapter/ent/casbinrule"
"github.com/casbin/ent-adapter/ent/predicate"
"github.com/pkg/errors"

"github.com/casbin/casbin/v2/model"
"github.com/casbin/ent-adapter/ent"
_ "github.com/go-sql-driver/mysql"
_ "github.com/jackc/pgx/v4/stdlib"
_ "github.com/lib/pq"

//_ "github.com/mattn/go-sqlite3"
"github.com/pkg/errors"
"github.com/casbin/ent-adapter/ent/casbinrule"
"github.com/casbin/ent-adapter/ent/predicate"
)

const (
Expand Down Expand Up @@ -315,8 +310,10 @@ func (a *Adapter) WithTx(fn func(tx *ent.Tx) error) error {
}

func loadPolicyLine(line *ent.CasbinRule, model model.Model) {
var p = []string{line.Ptype,
line.V0, line.V1, line.V2, line.V3, line.V4, line.V5}
var p = []string{
line.Ptype,
line.V0, line.V1, line.V2, line.V3, line.V4, line.V5,
}

var lineText string
if line.V5 != "" {
Expand Down Expand Up @@ -443,7 +440,8 @@ func (a *Adapter) UpdatePolicies(sec string, ptype string, oldRules, newRules []
}

// UpdateFilteredPolicies deletes old rules and adds new rules.
func (a *Adapter) UpdateFilteredPolicies(sec string, ptype string, newPolicies [][]string, fieldIndex int, fieldValues ...string) ([][]string, error) {
func (a *Adapter) UpdateFilteredPolicies(sec string, ptype string, newPolicies [][]string, fieldIndex int,
fieldValues ...string) ([][]string, error) {
oldPolicies := make([][]string, 0)
err := a.WithTx(func(tx *ent.Tx) error {
cond := make([]predicate.CasbinRule, 0)
Expand Down
56 changes: 33 additions & 23 deletions ent/casbinrule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 48 additions & 1 deletion ent/casbinrule/casbinrule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3328c39

Please sign in to comment.