本文整理汇总了Golang中github.com/cayleygraph/cayley/graph.Options.BoolKey方法的典型用法代码示例。如果您正苦于以下问题:Golang Options.BoolKey方法的具体用法?Golang Options.BoolKey怎么用?Golang Options.BoolKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cayleygraph/cayley/graph.Options
的用法示例。
在下文中一共展示了Options.BoolKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newQuadStore
func newQuadStore(addr string, options graph.Options) (graph.QuadStore, error) {
var qs QuadStore
conn, err := connectSQLTables(addr, options)
if err != nil {
return nil, err
}
localOpt, localOptOk, err := options.BoolKey("local_optimize")
if err != nil {
return nil, err
}
qs.db = conn
qs.sqlFlavor = "postgres"
qs.size = -1
qs.sizes = lru.New(1024)
qs.ids = lru.New(1024)
// Skip size checking by default.
qs.noSizes = true
if localOptOk {
if localOpt {
qs.noSizes = false
}
}
qs.useEstimates, _, err = options.BoolKey("use_estimates")
if err != nil {
return nil, err
}
return &qs, nil
}
示例2: NewSingleReplication
func NewSingleReplication(qs graph.QuadStore, opts graph.Options) (graph.QuadWriter, error) {
var (
ignoreMissing bool
ignoreDuplicate bool
err error
)
if *graph.IgnoreMissing {
ignoreMissing = true
} else {
ignoreMissing, _, err = opts.BoolKey("ignore_missing")
if err != nil {
return nil, err
}
}
if *graph.IgnoreDup {
ignoreDuplicate = true
} else {
ignoreDuplicate, _, err = opts.BoolKey("ignore_duplicate")
if err != nil {
return nil, err
}
}
return &Single{
currentID: qs.Horizon(),
qs: qs,
ignoreOpts: graph.IgnoreOpts{
IgnoreDup: ignoreDuplicate,
IgnoreMissing: ignoreMissing,
},
}, nil
}
示例3: newQuadStore
func newQuadStore(path string, options graph.Options) (graph.QuadStore, error) {
var qs QuadStore
var err error
db, err := bolt.Open(path, 0600, nil)
if err != nil {
clog.Errorf("Error, couldn't open! %v", err)
return nil, err
}
qs.db = db
// BoolKey returns false on non-existence. IE, Sync by default.
qs.db.NoSync, _, err = options.BoolKey("nosync")
if err != nil {
return nil, err
}
err = qs.getMetadata()
if err == errNoBucket {
return nil, errors.New("bolt: quadstore has not been initialised")
} else if err != nil {
return nil, err
}
if qs.version != latestDataVersion {
return nil, errors.New("bolt: data version is out of date. Run cayleyupgrade for your config to update the data.")
}
return &qs, nil
}