Update vendor/
This commit is contained in:
1
vendor/github.com/asdine/storm/.travis.yml
generated
vendored
1
vendor/github.com/asdine/storm/.travis.yml
generated
vendored
@@ -7,6 +7,7 @@ go:
|
||||
- 1.7
|
||||
- 1.8
|
||||
- 1.9
|
||||
- "1.10"
|
||||
- tip
|
||||
|
||||
script:
|
||||
|
9
vendor/github.com/asdine/storm/README.md
generated
vendored
9
vendor/github.com/asdine/storm/README.md
generated
vendored
@@ -307,6 +307,13 @@ q.Re("Name", "^D")
|
||||
|
||||
// In the given slice of values
|
||||
q.In("Group", []string{"Staff", "Admin"})
|
||||
|
||||
// Comparing fields
|
||||
q.EqF("FieldName", "SecondFieldName")
|
||||
q.LtF("FieldName", "SecondFieldName")
|
||||
q.GtF("FieldName", "SecondFieldName")
|
||||
q.LteF("FieldName", "SecondFieldName")
|
||||
q.GteF("FieldName", "SecondFieldName")
|
||||
```
|
||||
|
||||
Matchers can also be combined with `And`, `Or` and `Not`:
|
||||
@@ -598,6 +605,8 @@ db.Delete("sessions", someObjectId)
|
||||
db.Delete("weird storage", "754-3010")
|
||||
```
|
||||
|
||||
You can find other useful methods in the [documentation](https://godoc.org/github.com/asdine/storm#KeyValueStore).
|
||||
|
||||
## BoltDB
|
||||
|
||||
BoltDB is still easily accessible and can be used as usual
|
||||
|
11
vendor/github.com/asdine/storm/internal/boltdb.go
generated
vendored
11
vendor/github.com/asdine/storm/internal/boltdb.go
generated
vendored
@@ -42,7 +42,16 @@ type RangeCursor struct {
|
||||
// First element
|
||||
func (c *RangeCursor) First() ([]byte, []byte) {
|
||||
if c.Reverse {
|
||||
return c.C.Seek(c.Max)
|
||||
k, v := c.C.Seek(c.Max)
|
||||
|
||||
// If Seek doesn't find a key it goes to the next.
|
||||
// If so, we need to get the previous one to avoid
|
||||
// including bigger values. #218
|
||||
if !bytes.HasPrefix(k, c.Max) && k != nil {
|
||||
k, v = c.C.Prev()
|
||||
}
|
||||
|
||||
return k, v
|
||||
}
|
||||
|
||||
return c.C.Seek(c.Min)
|
||||
|
25
vendor/github.com/asdine/storm/kv.go
generated
vendored
25
vendor/github.com/asdine/storm/kv.go
generated
vendored
@@ -18,6 +18,8 @@ type KeyValueStore interface {
|
||||
GetBytes(bucketName string, key interface{}) ([]byte, error)
|
||||
// SetBytes sets a raw value into a bucket.
|
||||
SetBytes(bucketName string, key interface{}, value []byte) error
|
||||
// KeyExists reports the presence of a key in a bucket.
|
||||
KeyExists(bucketName string, key interface{}) (bool, error)
|
||||
}
|
||||
|
||||
// GetBytes gets a raw value from a bucket.
|
||||
@@ -143,3 +145,26 @@ func (n *node) delete(tx *bolt.Tx, bucketName string, id []byte) error {
|
||||
|
||||
return bucket.Delete(id)
|
||||
}
|
||||
|
||||
// KeyExists reports the presence of a key in a bucket.
|
||||
func (n *node) KeyExists(bucketName string, key interface{}) (bool, error) {
|
||||
id, err := toBytes(key, n.codec)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
var exists bool
|
||||
return exists, n.readTx(func(tx *bolt.Tx) error {
|
||||
bucket := n.GetBucket(tx, bucketName)
|
||||
if bucket == nil {
|
||||
return ErrNotFound
|
||||
}
|
||||
|
||||
v := bucket.Get(id)
|
||||
if v != nil {
|
||||
exists = true
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
28
vendor/github.com/asdine/storm/q/fieldmatcher.go
generated
vendored
28
vendor/github.com/asdine/storm/q/fieldmatcher.go
generated
vendored
@@ -2,6 +2,7 @@ package q
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go/token"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
@@ -37,3 +38,30 @@ func (r fieldMatcherDelegate) MatchValue(v *reflect.Value) (bool, error) {
|
||||
}
|
||||
return r.MatchField(field.Interface())
|
||||
}
|
||||
|
||||
// NewField2FieldMatcher creates a Matcher for a given field1 and field2.
|
||||
func NewField2FieldMatcher(field1, field2 string, tok token.Token) Matcher {
|
||||
return field2fieldMatcherDelegate{Field1: field1, Field2: field2, Tok: tok}
|
||||
}
|
||||
|
||||
type field2fieldMatcherDelegate struct {
|
||||
Field1, Field2 string
|
||||
Tok token.Token
|
||||
}
|
||||
|
||||
func (r field2fieldMatcherDelegate) Match(i interface{}) (bool, error) {
|
||||
v := reflect.Indirect(reflect.ValueOf(i))
|
||||
return r.MatchValue(&v)
|
||||
}
|
||||
|
||||
func (r field2fieldMatcherDelegate) MatchValue(v *reflect.Value) (bool, error) {
|
||||
field1 := v.FieldByName(r.Field1)
|
||||
if !field1.IsValid() {
|
||||
return false, ErrUnknownField
|
||||
}
|
||||
field2 := v.FieldByName(r.Field2)
|
||||
if !field2.IsValid() {
|
||||
return false, ErrUnknownField
|
||||
}
|
||||
return compare(field1.Interface(), field2.Interface(), r.Tok), nil
|
||||
}
|
||||
|
25
vendor/github.com/asdine/storm/q/tree.go
generated
vendored
25
vendor/github.com/asdine/storm/q/tree.go
generated
vendored
@@ -178,6 +178,11 @@ func Eq(field string, v interface{}) Matcher {
|
||||
return NewFieldMatcher(field, &cmp{value: v, token: token.EQL})
|
||||
}
|
||||
|
||||
// EqF matcher, checks if the given field is equal to the given field
|
||||
func EqF(field1, field2 string) Matcher {
|
||||
return NewField2FieldMatcher(field1, field2, token.EQL)
|
||||
}
|
||||
|
||||
// StrictEq matcher, checks if the given field is deeply equal to the given value
|
||||
func StrictEq(field string, v interface{}) Matcher {
|
||||
return NewFieldMatcher(field, &strictEq{value: v})
|
||||
@@ -188,21 +193,41 @@ func Gt(field string, v interface{}) Matcher {
|
||||
return NewFieldMatcher(field, &cmp{value: v, token: token.GTR})
|
||||
}
|
||||
|
||||
// GtF matcher, checks if the given field is greater than the given field
|
||||
func GtF(field1, field2 string) Matcher {
|
||||
return NewField2FieldMatcher(field1, field2, token.GTR)
|
||||
}
|
||||
|
||||
// Gte matcher, checks if the given field is greater than or equal to the given value
|
||||
func Gte(field string, v interface{}) Matcher {
|
||||
return NewFieldMatcher(field, &cmp{value: v, token: token.GEQ})
|
||||
}
|
||||
|
||||
// GteF matcher, checks if the given field is greater than or equal to the given field
|
||||
func GteF(field1, field2 string) Matcher {
|
||||
return NewField2FieldMatcher(field1, field2, token.GEQ)
|
||||
}
|
||||
|
||||
// Lt matcher, checks if the given field is lesser than the given value
|
||||
func Lt(field string, v interface{}) Matcher {
|
||||
return NewFieldMatcher(field, &cmp{value: v, token: token.LSS})
|
||||
}
|
||||
|
||||
// LtF matcher, checks if the given field is lesser than the given field
|
||||
func LtF(field1, field2 string) Matcher {
|
||||
return NewField2FieldMatcher(field1, field2, token.LSS)
|
||||
}
|
||||
|
||||
// Lte matcher, checks if the given field is lesser than or equal to the given value
|
||||
func Lte(field string, v interface{}) Matcher {
|
||||
return NewFieldMatcher(field, &cmp{value: v, token: token.LEQ})
|
||||
}
|
||||
|
||||
// LteF matcher, checks if the given field is lesser than or equal to the given field
|
||||
func LteF(field1, field2 string) Matcher {
|
||||
return NewField2FieldMatcher(field1, field2, token.LEQ)
|
||||
}
|
||||
|
||||
// In matcher, checks if the given field matches one of the value of the given slice.
|
||||
// v must be a slice.
|
||||
func In(field string, v interface{}) Matcher {
|
||||
|
Reference in New Issue
Block a user