本文整理汇总了Golang中github.com/google/cayley/graph/iterator.NextUID函数的典型用法代码示例。如果您正苦于以下问题:Golang NextUID函数的具体用法?Golang NextUID怎么用?Golang NextUID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NextUID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewAllIterator
func NewAllIterator(prefix string, d quad.Direction, ts *TripleStore) *AllIterator {
opts := &opt.ReadOptions{
DontFillCache: true,
}
it := AllIterator{
uid: iterator.NextUID(),
ro: opts,
iter: ts.db.NewIterator(nil, opts),
prefix: []byte(prefix),
dir: d,
open: true,
ts: ts,
}
it.iter.Seek(it.prefix)
if !it.iter.Valid() {
// FIXME(kortschak) What are the semantics here? Is this iterator usable?
// If not, we should return nil *Iterator and an error.
it.open = false
it.iter.Release()
}
return &it
}
开发者ID:neevor,项目名称:cayley,代码行数:25,代码来源:all_iterator.go
示例2: Clone
func (it *Iterator) Clone() graph.Iterator {
var iter *b.Enumerator
if it.result != nil {
var ok bool
iter, ok = it.tree.Seek(it.result.(int64))
if !ok {
panic("value unexpectedly missing")
}
} else {
var err error
iter, err = it.tree.SeekFirst()
if err != nil {
iter = nil
}
}
m := &Iterator{
uid: iterator.NextUID(),
ts: it.ts,
tree: it.tree,
iter: iter,
data: it.data,
}
m.tags.CopyFrom(it)
return m
}
开发者ID:Joeento,项目名称:cayley,代码行数:27,代码来源:iterator.go
示例3: NewAllIterator
func NewAllIterator(qs *QuadStore, kind string) *Iterator {
if kind != nodeKind && kind != quadKind {
glog.Error("Cannot create iterator for an unknown kind")
return &Iterator{done: true}
}
if qs.context == nil {
glog.Error("Cannot create iterator without a valid context")
return &Iterator{done: true}
}
var size int64
if kind == nodeKind {
size = qs.NodeSize()
} else {
size = qs.Size()
}
return &Iterator{
uid: iterator.NextUID(),
qs: qs,
size: size,
dir: quad.Any,
isAll: true,
kind: kind,
done: false,
}
}
开发者ID:e4x,项目名称:cayley,代码行数:27,代码来源:iterator.go
示例4: TestSQLNodeIteration
func TestSQLNodeIteration(t *testing.T) {
if *postgres_path == "" {
t.SkipNow()
}
db, err := newQuadStore(*postgres_path, nil)
if err != nil {
t.Fatal(err)
}
link := NewSQLLinkIterator(db.(*QuadStore), quad.Object, "/en/humphrey_bogart")
it := &SQLIterator{
uid: iterator.NextUID(),
qs: db.(*QuadStore),
sql: &SQLNodeIterator{
tableName: newTableName(),
linkIt: sqlItDir{
it: link.sql,
dir: quad.Subject,
},
},
}
s, v := it.sql.buildSQL(true, nil)
t.Log(s, v)
c := 0
for graph.Next(it) {
t.Log(it.Result())
c += 1
}
if c != 56 {
t.Errorf("Not enough results, got %d expected 56", c)
}
}
开发者ID:e4x,项目名称:cayley,代码行数:32,代码来源:sql_link_iterator_test.go
示例5: NewIterator
func NewIterator(prefix string, d quad.Direction, value graph.Value, qs *QuadStore) *Iterator {
vb := value.(Token)
p := make([]byte, 0, 2+quad.HashSize)
p = append(p, []byte(prefix)...)
p = append(p, []byte(vb[1:])...)
opts := &opt.ReadOptions{
DontFillCache: true,
}
it := Iterator{
uid: iterator.NextUID(),
nextPrefix: p,
checkID: vb,
dir: d,
originalPrefix: prefix,
ro: opts,
iter: qs.db.NewIterator(nil, opts),
open: true,
qs: qs,
}
ok := it.iter.Seek(it.nextPrefix)
if !ok {
it.open = false
it.iter.Release()
glog.Error("Opening LevelDB iterator couldn't seek to location ", it.nextPrefix)
}
return &it
}
开发者ID:dennwc,项目名称:cayley,代码行数:31,代码来源:iterator.go
示例6: NewIterator
func NewIterator(qs *TripleStore, collection string, d quad.Direction, val graph.Value) *Iterator {
name := qs.NameOf(val)
constraint := bson.M{d.String(): name}
size, err := qs.db.C(collection).Find(constraint).Count()
if err != nil {
// FIXME(kortschak) This should be passed back rather than just logging.
glog.Errorln("Trouble getting size for iterator! ", err)
return nil
}
return &Iterator{
uid: iterator.NextUID(),
name: name,
constraint: constraint,
collection: collection,
qs: qs,
dir: d,
iter: qs.db.C(collection).Find(constraint).Iter(),
size: int64(size),
hash: val.(string),
isAll: false,
}
}
开发者ID:kris-lab,项目名称:cayley,代码行数:25,代码来源:iterator.go
示例7: NewIterator
func NewIterator(prefix string, d quad.Direction, value graph.Value, qs *TripleStore) *Iterator {
vb := value.([]byte)
p := make([]byte, 0, 2+qs.hasher.Size())
p = append(p, []byte(prefix)...)
p = append(p, []byte(vb[1:])...)
opts := &opt.ReadOptions{
DontFillCache: true,
}
it := Iterator{
uid: iterator.NextUID(),
nextPrefix: p,
checkId: vb,
dir: d,
originalPrefix: prefix,
ro: opts,
iter: qs.db.NewIterator(nil, opts),
open: true,
qs: qs,
}
ok := it.iter.Seek(it.nextPrefix)
if !ok {
// FIXME(kortschak) What are the semantics here? Is this iterator usable?
// If not, we should return nil *Iterator and an error.
it.open = false
it.iter.Release()
}
return &it
}
开发者ID:neevor,项目名称:cayley,代码行数:32,代码来源:iterator.go
示例8: NewSQLIterator
func NewSQLIterator(qs *QuadStore, sql sqlIterator) *SQLIterator {
l := &SQLIterator{
uid: iterator.NextUID(),
qs: qs,
sql: sql,
}
return l
}
开发者ID:e4x,项目名称:cayley,代码行数:8,代码来源:sql_iterator.go
示例9: NewAllIterator
func NewAllIterator(qs *QuadStore, table string) *AllIterator {
it := &AllIterator{
uid: iterator.NextUID(),
qs: qs,
table: table,
}
return it
}
开发者ID:e4x,项目名称:cayley,代码行数:8,代码来源:all_iterator.go
示例10: NewAllIterator
func NewAllIterator(bucket []byte, d quad.Direction, qs *QuadStore) *AllIterator {
return &AllIterator{
uid: iterator.NextUID(),
bucket: bucket,
dir: d,
qs: qs,
}
}
开发者ID:ericcapricorn,项目名称:cayley,代码行数:8,代码来源:all_iterator.go
示例11: NewLlrbIterator
func NewLlrbIterator(tree *llrb.LLRB, data string) *Iterator {
return &Iterator{
uid: iterator.NextUID(),
tree: tree,
iterLast: Int64(-1),
data: data,
}
}
开发者ID:jacqui,项目名称:cayley,代码行数:8,代码来源:iterator.go
示例12: NewAllIterator
// NewAllIterator allocates and initializes an AllIterator that is returned to
// the caller.
func NewAllIterator(db string, d quad.Direction, qs *QuadStore) *AllIterator {
return &AllIterator{
uid: iterator.NextUID(),
db: db,
dir: d,
qs: qs,
}
}
开发者ID:bmatsuo,项目名称:cayley,代码行数:10,代码来源:all_iterator.go
示例13: Clone
func (it *SQLIterator) Clone() graph.Iterator {
m := &SQLIterator{
uid: iterator.NextUID(),
qs: it.qs,
sql: it.sql.sqlClone(),
}
return m
}
开发者ID:e4x,项目名称:cayley,代码行数:8,代码来源:sql_iterator.go
示例14: NewLinksTo
// NewLinksTo constructs a new indexed LinksTo iterator for Mongo around a direction
// and a subiterator of nodes.
func NewLinksTo(qs *QuadStore, it graph.Iterator, collection string, d quad.Direction, lset []graph.Linkage) *LinksTo {
return &LinksTo{
uid: iterator.NextUID(),
qs: qs,
primaryIt: it,
dir: d,
nextIt: nil,
lset: lset,
collection: collection,
}
}
开发者ID:e4x,项目名称:cayley,代码行数:13,代码来源:indexed_linksto.go
示例15: NewIteratorWithConstraints
func NewIteratorWithConstraints(qs *QuadStore, collection string, constraint bson.M) *Iterator {
return &Iterator{
uid: iterator.NextUID(),
qs: qs,
dir: quad.Any,
constraint: constraint,
collection: collection,
iter: nil,
size: -1,
hash: "",
isAll: false,
}
}
开发者ID:dennwc,项目名称:cayley,代码行数:13,代码来源:iterator.go
示例16: NewAllIterator
func NewAllIterator(qs *QuadStore, collection string) *Iterator {
return &Iterator{
uid: iterator.NextUID(),
qs: qs,
dir: quad.Any,
constraint: nil,
collection: collection,
iter: nil,
size: -1,
hash: "",
isAll: true,
}
}
开发者ID:dennwc,项目名称:cayley,代码行数:13,代码来源:iterator.go
示例17: NewIterator
func NewIterator(tree *b.Tree, data string, ts *TripleStore) *Iterator {
iter, err := tree.SeekFirst()
if err != nil {
iter = nil
}
return &Iterator{
uid: iterator.NextUID(),
ts: ts,
tree: tree,
iter: iter,
data: data,
}
}
开发者ID:Joeento,项目名称:cayley,代码行数:13,代码来源:iterator.go
示例18: NewIterator
func NewIterator(tree *b.Tree, qs *QuadStore, d quad.Direction, value graph.Value) *Iterator {
iter, err := tree.SeekFirst()
if err != nil {
iter = nil
}
return &Iterator{
uid: iterator.NextUID(),
qs: qs,
tree: tree,
iter: iter,
d: d,
value: value,
}
}
开发者ID:sdcoffey,项目名称:Olympus,代码行数:14,代码来源:iterator.go
示例19: NewSQLLinkIterator
func NewSQLLinkIterator(qs *QuadStore, d quad.Direction, val string) *SQLIterator {
l := &SQLIterator{
uid: iterator.NextUID(),
qs: qs,
sql: &SQLLinkIterator{
constraints: []constraint{
constraint{
dir: d,
vals: []string{val},
},
},
tableName: newTableName(),
size: 0,
},
}
return l
}
开发者ID:e4x,项目名称:cayley,代码行数:17,代码来源:sql_iterator.go
示例20: newSQLLinkIterator
func newSQLLinkIterator(qs *QuadStore, d quad.Direction, hash NodeHash) *SQLIterator {
l := &SQLIterator{
uid: iterator.NextUID(),
qs: qs,
sql: &SQLLinkIterator{
constraints: []constraint{
constraint{
dir: d,
hashes: []NodeHash{hash},
},
},
tableName: newTableName(),
size: 0,
},
}
return l
}
开发者ID:dennwc,项目名称:cayley,代码行数:17,代码来源:sql_iterator.go
注:本文中的github.com/google/cayley/graph/iterator.NextUID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论