Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type DbConfig
- type Resolver
- func (r *Resolver) GetChunkStore(str string) (chunks.ChunkStore, error)
- func (r *Resolver) GetDatabase(str string) (datas.Database, error)
- func (r *Resolver) GetDataset(str string) (datas.Database, datas.Dataset, error)
- func (r *Resolver) GetPath(str string) (datas.Database, types.Value, error)
- func (r *Resolver) ResolveDbSpec(str string) string
- func (r *Resolver) ResolvePathSpec(str string) string
Constants ¶
const ( NomsConfigFile = ".nomsconfig" DefaultDbAlias = "default" )
Variables ¶
var NoConfig = errors.New(fmt.Sprintf("no %s found", NomsConfigFile))
Functions ¶
This section is empty.
Types ¶
type Config ¶
func FindNomsConfig ¶
Find the closest directory containing .nomsconfig starting in cwd and then searching up ancestor tree. Look first looking in cwd and then up through its ancestors
func ReadConfig ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver() *Resolver
A Resolver enables using db defaults, db aliases and dataset '.' replacement in command line arguments when a .nomsconfig file is present. To use it, create a config resolver before command line processing and use it to resolve each dataspec argument in succession.
func (*Resolver) GetChunkStore ¶
func (r *Resolver) GetChunkStore(str string) (chunks.ChunkStore, error)
Resolve string to a chunkstore. Like ResolveDatabase, but returns the underlying ChunkStore
func (*Resolver) GetDatabase ¶
Resolve string to database spec. If a config is present,
- resolve a db alias to its db spec
- resolve "" to the default db spec
func (*Resolver) GetDataset ¶
Resolve string to a dataset. If a config is present,
- if no db prefix is present, assume the default db
- if the db prefix is an alias, replace it
func (*Resolver) GetPath ¶
Resolve string to a value path. If a config is present,
- if no db spec is present, assume the default db
- if the db spec is an alias, replace it
func (*Resolver) ResolveDbSpec ¶
Resolve string to database name. If config is defined:
- replace the empty string with the default db url
- replace any db alias with it's url
func (*Resolver) ResolvePathSpec ¶
Resolve string to dataset or path name.
- replace database name as described in ResolveDatabase
- if this is the first call to ResolvePath, remember the datapath part for subsequent calls.
- if this is not the first call and a "." is used, replace it with the first datapath.