Skip to content

Commit

Permalink
Fix linert before(after) order error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhs committed Nov 23, 2018
1 parent 5b3ba75 commit 63f4807
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions command/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ func LRange(ctx *Context, txn *db.Transaction) (OnCommit, error) {
func LInsert(ctx *Context, txn *db.Transaction) (OnCommit, error) {
key := []byte(ctx.Args[0])

after := false
before := false
switch strings.ToLower(ctx.Args[1]) {
case "before":
after = false
before = true
case "after":
after = true
before = false
default:
return nil, ErrSyntax
}
Expand All @@ -155,7 +155,7 @@ func LInsert(ctx *Context, txn *db.Transaction) (OnCommit, error) {
return Integer(ctx.Out, -1), nil
}

err = lst.Insert(pivot, value, after)
err = lst.Insert(pivot, value, before)
if err != nil {
return nil, errors.New("ERR " + err.Error())
}
Expand Down

0 comments on commit 63f4807

Please sign in to comment.