本文整理汇总了Golang中github.com/cayleygraph/cayley/quad.Direction类的典型用法代码示例。如果您正苦于以下问题:Golang Direction类的具体用法?Golang Direction怎么用?Golang Direction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Direction类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: sizeForIterator
func (qs *QuadStore) sizeForIterator(isAll bool, dir quad.Direction, hash NodeHash) int64 {
var err error
if isAll {
return qs.Size()
}
if qs.noSizes {
if dir == quad.Predicate {
return (qs.Size() / 100) + 1
}
return (qs.Size() / 1000) + 1
}
if val, ok := qs.sizes.Get(hash.String() + string(dir.Prefix())); ok {
return val.(int64)
}
var size int64
if clog.V(4) {
clog.Infof("sql: getting size for select %s, %v", dir.String(), hash)
}
err = qs.db.QueryRow(
fmt.Sprintf("SELECT count(*) FROM quads WHERE %s_hash = $1;", dir.String()), hash.toSQL()).Scan(&size)
if err != nil {
clog.Errorf("Error getting size from SQL database: %v", err)
return 0
}
qs.sizes.Put(hash.String()+string(dir.Prefix()), size)
return size
}
开发者ID:rlugojr,项目名称:cayley,代码行数:27,代码来源:quadstore.go
示例2: QuadIterator
func (qs *QuadStore) QuadIterator(d quad.Direction, val graph.Value) graph.Iterator {
var prefix string
switch d {
case quad.Subject:
prefix = "sp"
case quad.Predicate:
prefix = "po"
case quad.Object:
prefix = "os"
case quad.Label:
prefix = "cp"
default:
panic("unreachable " + d.String())
}
return NewIterator(prefix, d, val, qs)
}
开发者ID:RamboWANG,项目名称:cayley,代码行数:16,代码来源:quadstore.go
示例3: NewIterator
func NewIterator(qs *QuadStore, collection string, d quad.Direction, val graph.Value) *Iterator {
h := val.(NodeHash)
constraint := bson.M{d.String(): string(h)}
return &Iterator{
uid: iterator.NextUID(),
constraint: constraint,
collection: collection,
qs: qs,
dir: d,
iter: nil,
size: -1,
hash: h,
isAll: false,
}
}
开发者ID:coralproject,项目名称:xenia,代码行数:17,代码来源:iterator.go
示例4: NewIterator
func NewIterator(qs *QuadStore, collection string, d quad.Direction, val graph.Value) *Iterator {
name := qs.NameOf(val)
constraint := bson.M{d.String(): name}
return &Iterator{
uid: iterator.NextUID(),
name: name,
constraint: constraint,
collection: collection,
qs: qs,
dir: d,
iter: nil,
size: -1,
hash: val.(string),
isAll: false,
}
}
开发者ID:RamboWANG,项目名称:cayley,代码行数:18,代码来源:iterator.go
示例5: buildIteratorFor
func (it *LinksTo) buildIteratorFor(d quad.Direction, val graph.Value) *mgo.Iter {
name := it.qs.NameOf(val)
constraint := it.buildConstraint()
constraint[d.String()] = name
return it.qs.db.C(it.collection).Find(constraint).Iter()
}
开发者ID:RamboWANG,项目名称:cayley,代码行数:6,代码来源:indexed_linksto.go
示例6: buildIteratorFor
func (it *LinksTo) buildIteratorFor(d quad.Direction, val graph.Value) *mgo.Iter {
constraint := it.buildConstraint()
constraint[d.String()] = string(val.(NodeHash))
return it.qs.db.C(it.collection).Find(constraint).Iter()
}
开发者ID:rlugojr,项目名称:cayley,代码行数:5,代码来源:indexed_linksto.go
注:本文中的github.com/cayleygraph/cayley/quad.Direction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论