github.com/cayleygraph/cayley@v0.7.7/graph/kv/registry.go (about) 1 package kv 2 3 import ( 4 "strings" 5 6 "github.com/cayleygraph/cayley/graph" 7 "github.com/hidal-go/hidalgo/kv" 8 ) 9 10 func init() { 11 for _, r := range kv.List() { 12 switch r.Name { 13 case "bolt": 14 continue // legacy: register manually; see comments in the bolt package 15 } 16 r := r 17 reg := Registration{ 18 InitFunc: func(s string, options graph.Options) (kv.KV, error) { 19 return r.OpenPath(s) 20 }, 21 NewFunc: func(s string, options graph.Options) (kv.KV, error) { 22 return r.OpenPath(s) 23 }, 24 IsPersistent: !r.Volatile, 25 } 26 name := r.Name 27 // override names for backward compatibility 28 // names are also nicer without the "flat." prefix 29 if strings.HasPrefix(name, "flat.") && !graph.IsRegistered(name[5:]) { 30 name = name[5:] 31 } 32 Register(name, reg) 33 } 34 }